add logging, use external link
parent
904e0bc49b
commit
8102258e3b
|
|
@ -44,7 +44,7 @@ export default function MonitorDetail({
|
||||||
const monitorNameElement = (
|
const monitorNameElement = (
|
||||||
<Text mt="sm" fw={700} style={{ display: 'inline-flex', alignItems: 'center' }}>
|
<Text mt="sm" fw={700} style={{ display: 'inline-flex', alignItems: 'center' }}>
|
||||||
{monitor.statusPageLink ? (
|
{monitor.statusPageLink ? (
|
||||||
<a href={monitor.statusPageLink} style={{ display: 'inline-flex', alignItems: 'center', color: 'inherit', textDecoration: 'none' }}>
|
<a href={monitor.statusPageLink} target="_blank" style={{ display: 'inline-flex', alignItems: 'center', color: 'inherit', textDecoration: 'none' }}>
|
||||||
{statusIcon} {monitor.name}
|
{statusIcon} {monitor.name}
|
||||||
</a>
|
</a>
|
||||||
) : (
|
) : (
|
||||||
|
|
|
||||||
|
|
@ -220,14 +220,18 @@ export default {
|
||||||
state.latency[monitor.id] = latencyLists
|
state.latency[monitor.id] = latencyLists
|
||||||
}
|
}
|
||||||
|
|
||||||
|
console.log(`statusChanged: ${statusChanged}, lastUpdate: ${state.lastUpdate}, currentTime: ${currentTimeSecond}`)
|
||||||
// Update state
|
// Update state
|
||||||
state.lastUpdate = Math.round(Date.now() / 1000)
|
// Allow for a cooldown period before writing to KV
|
||||||
if (
|
if (
|
||||||
statusChanged ||
|
statusChanged ||
|
||||||
currentTimeSecond - state.lastUpdate >= workerConfig.kvWriteCooldownMinutes * 60
|
currentTimeSecond - state.lastUpdate >= workerConfig.kvWriteCooldownMinutes * 60 - 10 // Allow for 10 seconds of clock drift
|
||||||
) {
|
) {
|
||||||
|
console.log("Updating state...")
|
||||||
state.lastUpdate = currentTimeSecond
|
state.lastUpdate = currentTimeSecond
|
||||||
await env.UPTIMEFLARE_STATE.put('state', JSON.stringify(state))
|
await env.UPTIMEFLARE_STATE.put('state', JSON.stringify(state))
|
||||||
|
} else {
|
||||||
|
console.log("Skipping state update due to cooldown period.")
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue