Eliminates the setInterval(1s) + per-second DB write by storing picksExpiresAt in draft_timers and using a targeted setTimeout per pick. Clients count down locally from the expiresAt timestamp, removing server-pushed timer-update events. Key changes: - database/schema.ts: add picksExpiresAt and picksStartedAt to draft_timers - server/timer.ts: full rewrite — schedulePickForSeason, rescheduleTimer, 30s recovery interval instead of 1s tick, overnight-pause resume scheduling - server/socket.ts: new timer-pick-started / timer-overnight-paused events, updated draft-state-sync to include expiresAt for reconnect recovery - draft.make-pick / draft.force-manual-pick: compute actual remaining from picksExpiresAt at pick time; call rescheduleTimer after the autodraft chain - useDraftSocketEvents: handle new timer events, restore countdown on reconnect - $leagueId.draft.$seasonId: client-side countdown useEffect from expiresAt - plans/zero-downtime-scaling.md: full 4-phase scaling plan for future reference Resolves 2351 unit tests (all passing). https://claude.ai/code/session_019k5J6Ty7uP5HxSx6CsbiBK
2 lines
No EOL
159 B
SQL
2 lines
No EOL
159 B
SQL
ALTER TABLE "draft_timers" ADD COLUMN "picks_expires_at" timestamp;--> statement-breakpoint
|
|
ALTER TABLE "draft_timers" ADD COLUMN "picks_started_at" timestamp; |