Split network daily hashrate indexing and weekly pool hashrate indexing

This commit is contained in:
nymkappa
2022-03-06 12:32:16 +01:00
parent 3e50e4541b
commit 7314582dd1
4 changed files with 139 additions and 46 deletions

View File

@@ -6,7 +6,7 @@ import logger from '../logger';
const sleep = (ms: number) => new Promise(res => setTimeout(res, ms));
class DatabaseMigration {
private static currentVersion = 8;
private static currentVersion = 9;
private queryTimeout = 120000;
private statisticsAddedIndexed = false;
@@ -133,6 +133,10 @@ class DatabaseMigration {
await this.$executeQuery(connection, 'ALTER TABLE `hashrates` ADD `type` enum("daily", "weekly") DEFAULT "daily"');
}
if (databaseSchemaVersion < 9) {
await this.$executeQuery(connection, 'ALTER TABLE `state` CHANGE `name` `name` varchar(100)')
}
connection.release();
} catch (e) {
connection.release();
@@ -276,6 +280,10 @@ class DatabaseMigration {
queries.push(`INSERT INTO state(name, number, string) VALUES ('last_hashrates_indexing', 0, NULL)`);
}
if (version < 9) {
queries.push(`INSERT INTO state(name, number, string) VALUES ('last_weekly_hashrates_indexing', 0, NULL)`);
}
return queries;
}