Preparing

This commit is contained in:
Louis Lam 2024-09-01 17:19:18 +08:00
parent c567e8eb8e
commit 2dfa6886b4
2 changed files with 20 additions and 0 deletions

View file

@ -711,6 +711,15 @@ class Database {
}
}
/**
* TODO: Migrate the old data in the heartbeat table to the new format (stat_daily, stat_hourly, stat_minutely)
* It should be run once while upgrading V1 to V2
* @returns {Promise<void>}
*/
static async migrateAggregateTable() {
}
}
module.exports = Database;

View file

@ -11,6 +11,17 @@ const DEFAULT_KEEP_PERIOD = 180;
*/
const clearOldData = async () => {
/*
* TODO:
* Since we have aggregated table now, we don't need so much data in heartbeat table.
* But we still need to keep the important rows, because they contain the message.
*
* In the heartbeat table:
* - important rows: keep according to the setting (keepDataPeriodDays) (default 180 days)
* - not important rows: keep 2 days
*/
let period = await setting("keepDataPeriodDays");
// Set Default Period