From d2ece2993ee1b0e05a6db9470b8e81e1701429c2 Mon Sep 17 00:00:00 2001 From: nymkappa Date: Wed, 27 Jul 2022 22:53:09 +0200 Subject: [PATCH 1/2] Silence LN db truncation messages is CONFIG.LIGHTNING.ENABLED = false --- backend/src/api/database-migration.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/backend/src/api/database-migration.ts b/backend/src/api/database-migration.ts index d9be6e1e7..8bb4c4abf 100644 --- a/backend/src/api/database-migration.ts +++ b/backend/src/api/database-migration.ts @@ -256,7 +256,9 @@ class DatabaseMigration { } if (databaseSchemaVersion < 26 && isBitcoin === true) { - this.uniqueLog(logger.notice, `'lightning_stats' table has been truncated. Will re-generate historical data from scratch.`); + if (config.LIGHTNING.ENABLED) { + this.uniqueLog(logger.notice, `'lightning_stats' table has been truncated. Will re-generate historical data from scratch.`); + } await this.$executeQuery(`TRUNCATE lightning_stats`); await this.$executeQuery('ALTER TABLE `lightning_stats` ADD tor_nodes int(11) NOT NULL DEFAULT "0"'); await this.$executeQuery('ALTER TABLE `lightning_stats` ADD clearnet_nodes int(11) NOT NULL DEFAULT "0"'); @@ -273,6 +275,9 @@ class DatabaseMigration { } if (databaseSchemaVersion < 28 && isBitcoin === true) { + if (config.LIGHTNING.ENABLED) { + this.uniqueLog(logger.notice, `'lightning_stats' and 'node_stats' tables have been truncated. Will re-generate historical data from scratch.`); + } await this.$executeQuery(`TRUNCATE lightning_stats`); await this.$executeQuery(`TRUNCATE node_stats`); await this.$executeQuery(`ALTER TABLE lightning_stats MODIFY added DATE`); From f610699ef46e9006e434bb7425dcf7f626b200d4 Mon Sep 17 00:00:00 2001 From: nymkappa Date: Wed, 27 Jul 2022 23:01:57 +0200 Subject: [PATCH 2/2] Remove useless notice message content --- backend/src/api/database-migration.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/backend/src/api/database-migration.ts b/backend/src/api/database-migration.ts index 8bb4c4abf..d26bfd6cc 100644 --- a/backend/src/api/database-migration.ts +++ b/backend/src/api/database-migration.ts @@ -9,8 +9,8 @@ class DatabaseMigration { private statisticsAddedIndexed = false; private uniqueLogs: string[] = []; - private blocksTruncatedMessage = `'blocks' table has been truncated. Re-indexing from scratch.`; - private hashratesTruncatedMessage = `'hashrates' table has been truncated. Re-indexing from scratch.`; + private blocksTruncatedMessage = `'blocks' table has been truncated.`; + private hashratesTruncatedMessage = `'hashrates' table has been truncated.`; /** * Avoid printing multiple time the same message @@ -257,7 +257,7 @@ class DatabaseMigration { if (databaseSchemaVersion < 26 && isBitcoin === true) { if (config.LIGHTNING.ENABLED) { - this.uniqueLog(logger.notice, `'lightning_stats' table has been truncated. Will re-generate historical data from scratch.`); + this.uniqueLog(logger.notice, `'lightning_stats' table has been truncated.`); } await this.$executeQuery(`TRUNCATE lightning_stats`); await this.$executeQuery('ALTER TABLE `lightning_stats` ADD tor_nodes int(11) NOT NULL DEFAULT "0"'); @@ -276,7 +276,7 @@ class DatabaseMigration { if (databaseSchemaVersion < 28 && isBitcoin === true) { if (config.LIGHTNING.ENABLED) { - this.uniqueLog(logger.notice, `'lightning_stats' and 'node_stats' tables have been truncated. Will re-generate historical data from scratch.`); + this.uniqueLog(logger.notice, `'lightning_stats' and 'node_stats' tables have been truncated.`); } await this.$executeQuery(`TRUNCATE lightning_stats`); await this.$executeQuery(`TRUNCATE node_stats`);