feat: make cooldown optional and remove it from simple config

This commit is contained in:
lyc8503 committed 2025-11-05 23:10:18 +08:00
1 parent 9401202575
commit 70ad2e8677
4 files changed
+3 -5

No files matched your search

+1 -1
View File
@@ -331,7 +331,7 @@ const Worker = {
// Allow for a cooldown period before writing to KV
if (
statusChanged ||
currentTimeSecond - state.lastUpdate >= workerConfig.kvWriteCooldownMinutes * 60 - 10 // Allow for 10 seconds of clock drift
currentTimeSecond - state.lastUpdate >= (workerConfig.kvWriteCooldownMinutes ?? 3) * 60 - 10 // Allow for 10 seconds of clock drift
) {
console.log('Updating state...')
state.lastUpdate = currentTimeSecond