Merge pull request #2876 from chakflying/fix/uptime-for-push-beat

Fix: Clear uptime cache on push beat
This commit is contained in:
Louis Lam 2023-03-03 22:24:06 +08:00 committed by GitHub
commit 36aef2ae0d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -7,6 +7,7 @@ const dayjs = require("dayjs");
const { UP, MAINTENANCE, DOWN, PENDING, flipStatus, log } = require("../../src/util"); const { UP, MAINTENANCE, DOWN, PENDING, flipStatus, log } = require("../../src/util");
const StatusPage = require("../model/status_page"); const StatusPage = require("../model/status_page");
const { UptimeKumaServer } = require("../uptime-kuma-server"); const { UptimeKumaServer } = require("../uptime-kuma-server");
const { UptimeCacheList } = require("../uptime-cache-list");
const { makeBadge } = require("badge-maker"); const { makeBadge } = require("badge-maker");
const { badgeConstants } = require("../config"); const { badgeConstants } = require("../config");
@ -86,6 +87,7 @@ router.get("/api/push/:pushToken", async (request, response) => {
await R.store(bean); await R.store(bean);
io.to(monitor.user_id).emit("heartbeat", bean.toJSON()); io.to(monitor.user_id).emit("heartbeat", bean.toJSON());
UptimeCacheList.clearCache(monitor.id);
Monitor.sendStats(io, monitor.id, monitor.user_id); Monitor.sendStats(io, monitor.id, monitor.user_id);
response.json({ response.json({