mirror of
https://github.com/louislam/uptime-kuma.git
synced 2025-07-15 14:24:02 +02:00
fix: refresh interval getting incremented by 10 on status page despite a minimum of 5 (#5961)
Some checks are pending
Auto Test / auto-test (18, ARM64) (push) Blocked by required conditions
Auto Test / auto-test (18, macos-latest) (push) Blocked by required conditions
Auto Test / auto-test (18, ubuntu-latest) (push) Blocked by required conditions
Auto Test / auto-test (18, windows-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, ARM64) (push) Blocked by required conditions
Auto Test / auto-test (20, macos-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, ubuntu-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, windows-latest) (push) Blocked by required conditions
Auto Test / armv7-simple-test (18, ARMv7) (push) Waiting to run
Auto Test / armv7-simple-test (20, ARMv7) (push) Waiting to run
Auto Test / check-linters (push) Waiting to run
Auto Test / e2e-test (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
Merge Conflict Labeler / Labeling (push) Waiting to run
validate / json-yaml-validate (push) Waiting to run
validate / validate (push) Waiting to run
Some checks are pending
Auto Test / auto-test (18, ARM64) (push) Blocked by required conditions
Auto Test / auto-test (18, macos-latest) (push) Blocked by required conditions
Auto Test / auto-test (18, ubuntu-latest) (push) Blocked by required conditions
Auto Test / auto-test (18, windows-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, ARM64) (push) Blocked by required conditions
Auto Test / auto-test (20, macos-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, ubuntu-latest) (push) Blocked by required conditions
Auto Test / auto-test (20, windows-latest) (push) Blocked by required conditions
Auto Test / armv7-simple-test (18, ARMv7) (push) Waiting to run
Auto Test / armv7-simple-test (20, ARMv7) (push) Waiting to run
Auto Test / check-linters (push) Waiting to run
Auto Test / e2e-test (push) Waiting to run
CodeQL / Analyze (push) Waiting to run
Merge Conflict Labeler / Labeling (push) Waiting to run
validate / json-yaml-validate (push) Waiting to run
validate / validate (push) Waiting to run
Co-authored-by: Frank Elsinga <frank@elsinga.de>
This commit is contained in:
parent
03037e2a9a
commit
487cb8fdc5
2 changed files with 12 additions and 4 deletions
|
@ -720,7 +720,7 @@ export default {
|
|||
// Configure auto-refresh loop
|
||||
feedInterval = setInterval(() => {
|
||||
this.updateHeartbeatList();
|
||||
}, (this.config.autoRefreshInterval + 10) * 1000);
|
||||
}, Math.max(5, this.config.autoRefreshInterval) * 1000);
|
||||
|
||||
this.updateUpdateTimer();
|
||||
}).catch( function (error) {
|
||||
|
@ -806,7 +806,15 @@ export default {
|
|||
clearInterval(this.updateCountdown);
|
||||
|
||||
this.updateCountdown = setInterval(() => {
|
||||
const countdown = dayjs.duration(this.lastUpdateTime.add(this.config.autoRefreshInterval, "seconds").add(10, "seconds").diff(dayjs()));
|
||||
// rounding here as otherwise we sometimes skip numbers in cases of time drift
|
||||
const countdown = dayjs.duration(
|
||||
Math.round(
|
||||
this.lastUpdateTime
|
||||
.add(Math.max(5, this.config.autoRefreshInterval), "seconds")
|
||||
.diff(dayjs())
|
||||
/ 1000
|
||||
), "seconds");
|
||||
|
||||
if (countdown.as("seconds") < 0) {
|
||||
clearInterval(this.updateCountdown);
|
||||
} else {
|
||||
|
|
|
@ -121,8 +121,8 @@ test.describe("Status Page", () => {
|
|||
|
||||
await expect(page.getByTestId("update-countdown-text")).toContainText("00:");
|
||||
const updateCountdown = Number((await page.getByTestId("update-countdown-text").textContent()).match(/(\d+):(\d+)/)[2]);
|
||||
expect(updateCountdown).toBeGreaterThanOrEqual(refreshInterval); // cant be certain when the timer will start, so ensure it's within expected range
|
||||
expect(updateCountdown).toBeLessThanOrEqual(refreshInterval + 10);
|
||||
expect(updateCountdown).toBeGreaterThanOrEqual(refreshInterval - 10); // cant be certain when the timer will start, so ensure it's within expected range
|
||||
expect(updateCountdown).toBeLessThanOrEqual(refreshInterval);
|
||||
|
||||
await expect(page.locator("body")).toHaveClass(theme);
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue