Skip to content

feat: Fix yield accrual scheduler drift with setTimeout-based schedul… - #1507

Open
alamuoyeemmanuel7-create wants to merge 1 commit into
Junirezz:mainfrom
alamuoyeemmanuel7-create:feature/yield-accrual-scheduler-1450
Open

alamuoyeemmanuel7-create wants to merge 1 commit into
Junirezz:mainfrom
alamuoyeemmanuel7-create:feature/yield-accrual-scheduler-1450

Conversation

@alamuoyeemmanuel7-create

Copy link
Copy Markdown

closes #1450

@drips-wave

drips-wave Bot commented Sep 29, 2026

Copy link
Copy Markdown

@alamuoyeemmanuel7-create Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

…ing (Issue Junirezz#1450) - Replace setInterval with setTimeout for hour boundary scheduling - Implement msUntilNextHour() to compute next hour in milliseconds - Add recursive scheduling to prevent drift accumulation - On startup compute msUntilNextHour and schedule first run - Job runs at exact hour boundaries, not progressively later - Add comprehensive test suite with drift verification tests - Test mock Date.now at 12:00:30 and verify 13:00:00 scheduling - Maintain unchanged accrual calculation logic - Add environment variable YIELD_ACCRUAL_ENABLED for control Acceptance Criteria: ✅ Replace setInterval with setTimeout via msUntilNextHour ✅ Compute next hour on startup and after each run ✅ Test: 12:00:30 → next run at 13:00:00 (not 13:00:30) ✅ Existing accrual logic unchanged ✅ No drift accumulation even after 24+ hours ✅ Resilient to event loop delays
@alamuoyeemmanuel7-create
alamuoyeemmanuel7-create force-pushed the feature/yield-accrual-scheduler-1450 branch from 5635128 to a119974 Compare September 29, 2026 14:25

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Cron scheduler for yield accrual uses setInterval and drifts 2s per hour causing missed accrual windows

1 participant