mirror of
https://github.com/louislam/uptime-kuma.git
synced 2024-11-27 16:54:04 +00:00
wip
This commit is contained in:
parent
4632030a5e
commit
fe91ffcc9d
2 changed files with 32 additions and 26 deletions
|
@ -13,6 +13,9 @@ const DEFAULT_KEEP_PERIOD = 180;
|
||||||
|
|
||||||
const clearOldData = async () => {
|
const clearOldData = async () => {
|
||||||
|
|
||||||
|
// TODO: Temporary disable for testing
|
||||||
|
return;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* TODO:
|
* TODO:
|
||||||
* Since we have aggregated table now, we don't need so much data in heartbeat table.
|
* Since we have aggregated table now, we don't need so much data in heartbeat table.
|
||||||
|
|
|
@ -305,37 +305,40 @@ class UptimeCalculator {
|
||||||
}
|
}
|
||||||
await R.store(dailyStatBean);
|
await R.store(dailyStatBean);
|
||||||
|
|
||||||
let hourlyStatBean = await this.getHourlyStatBean(hourlyKey);
|
// TODO: For migration mode, we don't need to store old hourly and minutely data, but we need 24-hour's minutely data and 30-day's hourly data
|
||||||
hourlyStatBean.up = hourlyData.up;
|
if (false) {
|
||||||
hourlyStatBean.down = hourlyData.down;
|
let hourlyStatBean = await this.getHourlyStatBean(hourlyKey);
|
||||||
hourlyStatBean.ping = hourlyData.avgPing;
|
hourlyStatBean.up = hourlyData.up;
|
||||||
hourlyStatBean.pingMin = hourlyData.minPing;
|
hourlyStatBean.down = hourlyData.down;
|
||||||
hourlyStatBean.pingMax = hourlyData.maxPing;
|
hourlyStatBean.ping = hourlyData.avgPing;
|
||||||
{
|
hourlyStatBean.pingMin = hourlyData.minPing;
|
||||||
// eslint-disable-next-line no-unused-vars
|
hourlyStatBean.pingMax = hourlyData.maxPing;
|
||||||
const { up, down, avgPing, minPing, maxPing, timestamp, ...extras } = hourlyData;
|
{
|
||||||
if (Object.keys(extras).length > 0) {
|
// eslint-disable-next-line no-unused-vars
|
||||||
hourlyStatBean.extras = JSON.stringify(extras);
|
const { up, down, avgPing, minPing, maxPing, timestamp, ...extras } = hourlyData;
|
||||||
|
if (Object.keys(extras).length > 0) {
|
||||||
|
hourlyStatBean.extras = JSON.stringify(extras);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
await R.store(hourlyStatBean);
|
||||||
await R.store(hourlyStatBean);
|
|
||||||
|
|
||||||
let minutelyStatBean = await this.getMinutelyStatBean(divisionKey);
|
let minutelyStatBean = await this.getMinutelyStatBean(divisionKey);
|
||||||
minutelyStatBean.up = minutelyData.up;
|
minutelyStatBean.up = minutelyData.up;
|
||||||
minutelyStatBean.down = minutelyData.down;
|
minutelyStatBean.down = minutelyData.down;
|
||||||
minutelyStatBean.ping = minutelyData.avgPing;
|
minutelyStatBean.ping = minutelyData.avgPing;
|
||||||
minutelyStatBean.pingMin = minutelyData.minPing;
|
minutelyStatBean.pingMin = minutelyData.minPing;
|
||||||
minutelyStatBean.pingMax = minutelyData.maxPing;
|
minutelyStatBean.pingMax = minutelyData.maxPing;
|
||||||
{
|
{
|
||||||
// eslint-disable-next-line no-unused-vars
|
// eslint-disable-next-line no-unused-vars
|
||||||
const { up, down, avgPing, minPing, maxPing, timestamp, ...extras } = minutelyData;
|
const { up, down, avgPing, minPing, maxPing, timestamp, ...extras } = minutelyData;
|
||||||
if (Object.keys(extras).length > 0) {
|
if (Object.keys(extras).length > 0) {
|
||||||
minutelyStatBean.extras = JSON.stringify(extras);
|
minutelyStatBean.extras = JSON.stringify(extras);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
await R.store(minutelyStatBean);
|
||||||
}
|
}
|
||||||
await R.store(minutelyStatBean);
|
|
||||||
|
|
||||||
// TODO: it seems that it is also necessary to remove the old data in the migration mode
|
// No need to remove old data in migration mode
|
||||||
if (!this.migrationMode) {
|
if (!this.migrationMode) {
|
||||||
// Remove the old data
|
// Remove the old data
|
||||||
log.debug("uptime-calc", "Remove old data");
|
log.debug("uptime-calc", "Remove old data");
|
||||||
|
|
Loading…
Reference in a new issue