Move round scheduler in-app via instrumentation.ts, remove cron endpoint
All checks were successful
Build and Push Docker Image / build (push) Successful in 18s

Round open/close scheduling now runs as a 60s setInterval inside the
app process (via instrumentation.ts register hook) instead of needing
an external crontab. Removed the /api/cron/round-scheduler endpoint.

- DRAFT rounds auto-activate when windowOpenAt arrives
- ACTIVE rounds auto-close when windowCloseAt passes
- Uses existing activateRound/closeRound from round-engine

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
Matt
2026-02-18 11:35:28 +01:00
parent 9b1b319362
commit f814cf6dc4
3 changed files with 81 additions and 82 deletions

View File

@@ -25,5 +25,19 @@ export async function register() {
})
})
.catch(() => {})
// Round scheduler: check every 60s for rounds that need to open/close
import('./server/services/round-scheduler')
.then(({ processScheduledRounds }) => {
console.log('[Startup] Round scheduler started (60s interval)')
// Run once immediately, then every 60 seconds
processScheduledRounds().catch(() => {})
setInterval(() => {
processScheduledRounds().catch((err) => {
console.error('[RoundScheduler] Error:', err)
})
}, 60_000)
})
.catch(() => {})
}
}