You've already forked uptime-kuma
mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-11-27 22:48:46 +02:00
fix: Clear all statistics and clear heartbeats not resetting uptime statistics of monitors (#6398)
Some checks failed
Automatically close stale issues / stale (push) Has been cancelled
Merge Conflict Labeler / Labeling (push) Has been cancelled
validate / json-yaml-validate (push) Has been cancelled
validate / validate (push) Has been cancelled
Auto Test / armv7-simple-test (20, ARMv7) (push) Has been cancelled
Auto Test / armv7-simple-test (22, ARMv7) (push) Has been cancelled
Auto Test / check-linters (push) Has been cancelled
Auto Test / e2e-test (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Auto Test / auto-test (20, ARM64) (push) Has been cancelled
Auto Test / auto-test (20, macos-latest) (push) Has been cancelled
Auto Test / auto-test (20, ubuntu-22.04) (push) Has been cancelled
Auto Test / auto-test (20, windows-latest) (push) Has been cancelled
Auto Test / auto-test (25, ubuntu-22.04) (push) Has been cancelled
Auto Test / auto-test (24, ARM64) (push) Has been cancelled
Auto Test / auto-test (24, macos-latest) (push) Has been cancelled
Auto Test / auto-test (24, ubuntu-22.04) (push) Has been cancelled
Auto Test / auto-test (24, windows-latest) (push) Has been cancelled
Some checks failed
Automatically close stale issues / stale (push) Has been cancelled
Merge Conflict Labeler / Labeling (push) Has been cancelled
validate / json-yaml-validate (push) Has been cancelled
validate / validate (push) Has been cancelled
Auto Test / armv7-simple-test (20, ARMv7) (push) Has been cancelled
Auto Test / armv7-simple-test (22, ARMv7) (push) Has been cancelled
Auto Test / check-linters (push) Has been cancelled
Auto Test / e2e-test (push) Has been cancelled
CodeQL / Analyze (go) (push) Has been cancelled
CodeQL / Analyze (javascript-typescript) (push) Has been cancelled
Auto Test / auto-test (20, ARM64) (push) Has been cancelled
Auto Test / auto-test (20, macos-latest) (push) Has been cancelled
Auto Test / auto-test (20, ubuntu-22.04) (push) Has been cancelled
Auto Test / auto-test (20, windows-latest) (push) Has been cancelled
Auto Test / auto-test (25, ubuntu-22.04) (push) Has been cancelled
Auto Test / auto-test (24, ARM64) (push) Has been cancelled
Auto Test / auto-test (24, macos-latest) (push) Has been cancelled
Auto Test / auto-test (24, ubuntu-22.04) (push) Has been cancelled
Auto Test / auto-test (24, windows-latest) (push) Has been cancelled
This commit is contained in:
@@ -109,6 +109,7 @@ const { login } = require("./auth");
|
||||
const passwordHash = require("./password-hash");
|
||||
|
||||
const { Prometheus } = require("./prometheus");
|
||||
const { UptimeCalculator } = require("./uptime-calculator");
|
||||
|
||||
const hostname = config.hostname;
|
||||
|
||||
@@ -1592,9 +1593,11 @@ let needSetup = false;
|
||||
|
||||
log.info("manage", `Clear Heartbeats Monitor: ${monitorID} User ID: ${socket.userID}`);
|
||||
|
||||
await R.exec("DELETE FROM heartbeat WHERE monitor_id = ?", [
|
||||
monitorID
|
||||
]);
|
||||
await UptimeCalculator.clearStatistics(monitorID);
|
||||
|
||||
if (monitorID in server.monitorList) {
|
||||
await restartMonitor(socket.userID, monitorID);
|
||||
}
|
||||
|
||||
await sendHeartbeatList(socket, monitorID, true, true);
|
||||
|
||||
@@ -1616,10 +1619,7 @@ let needSetup = false;
|
||||
|
||||
log.info("manage", `Clear Statistics User ID: ${socket.userID}`);
|
||||
|
||||
await R.exec("DELETE FROM heartbeat");
|
||||
await R.exec("DELETE FROM stat_daily");
|
||||
await R.exec("DELETE FROM stat_hourly");
|
||||
await R.exec("DELETE FROM stat_minutely");
|
||||
await UptimeCalculator.clearAllStatistics();
|
||||
|
||||
// Restart all monitors to reset the stats
|
||||
for (let monitorID in server.monitorList) {
|
||||
|
||||
Reference in New Issue
Block a user