perf(redis): use sorted set index for O(log N) schedule claiming#14
perf(redis): use sorted set index for O(log N) schedule claiming#14isimisi wants to merge 1 commit into
Conversation
|
Hi! Thanks for the PR. We need a migration path for existing Redis users before merging this. With this change, Can we make the migration automatic/idempotent, or expose and document a required migration step? For example, on startup or first claim, backfill |
|
Hey @RomainLanz, great point. I completely missed the migration path for existing users. I'll add an automatic backfill that runs on startup: on first claimDueSchedule() call (or worker boot), scan schedules::index and populate schedules::due from any schedule that has a next_run_at. I'll make it idempotent so it's safe to run multiple times across worker restarts or multi-instance deployments. |
explanation: #13 (comment)