2.0-last-part
Louis Lam 3 months ago
parent c567e8eb8e
commit 2dfa6886b4

@ -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; module.exports = Database;

@ -11,6 +11,17 @@ const DEFAULT_KEEP_PERIOD = 180;
*/ */
const clearOldData = async () => { 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"); let period = await setting("keepDataPeriodDays");
// Set Default Period // Set Default Period

Loading…
Cancel
Save