Don't insert gapped gossip data upon restart
This commit is contained in:
parent
d7f2f4136c
commit
5b521cfc7c
@ -255,10 +255,10 @@ class LightningStatsImporter {
|
|||||||
const fileList = await fsPromises.readdir(this.topologiesFolder);
|
const fileList = await fsPromises.readdir(this.topologiesFolder);
|
||||||
fileList.sort().reverse();
|
fileList.sort().reverse();
|
||||||
|
|
||||||
const [rows]: any[] = await DB.query('SELECT UNIX_TIMESTAMP(added) AS added FROM lightning_stats');
|
const [rows]: any[] = await DB.query('SELECT UNIX_TIMESTAMP(added) as added, node_count FROM lightning_stats');
|
||||||
const existingStatsTimestamps = {};
|
const existingStatsTimestamps = {};
|
||||||
for (const row of rows) {
|
for (const row of rows) {
|
||||||
existingStatsTimestamps[row.added] = true;
|
existingStatsTimestamps[row.added] = rows[0];
|
||||||
}
|
}
|
||||||
|
|
||||||
for (const filename of fileList) {
|
for (const filename of fileList) {
|
||||||
@ -266,6 +266,7 @@ class LightningStatsImporter {
|
|||||||
|
|
||||||
// Stats exist already, don't calculate/insert them
|
// Stats exist already, don't calculate/insert them
|
||||||
if (existingStatsTimestamps[timestamp] !== undefined) {
|
if (existingStatsTimestamps[timestamp] !== undefined) {
|
||||||
|
latestNodeCount = existingStatsTimestamps[timestamp].node_count;
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user