PR #570: Fix misfire_grace_time=0 → 1 (APScheduler crash on startup)#439
Conversation
|
Warning Rate limit exceeded
You’ve run out of usage credits. Purchase more in the billing tab. ⌛ How to resolve this issue?After the wait time has elapsed, a review can be triggered using the We recommend that you space out your commits to avoid hitting the rate limit. 🚦 How do rate limits work?CodeRabbit enforces hourly rate limits for each developer per organization. Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout. Please see our FAQ for further information. ✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Overall Grade |
Security Reliability Complexity Hygiene |
Code Review Summary
| Analyzer | Status | Updated (UTC) | Details |
|---|---|---|---|
| Docker | May 15, 2026 3:29a.m. | Review ↗ | |
| JavaScript | May 15, 2026 3:29a.m. | Review ↗ | |
| Python | May 15, 2026 3:29a.m. | Review ↗ | |
| SQL | May 15, 2026 3:29a.m. | Review ↗ | |
| Secrets | May 15, 2026 3:29a.m. | Review ↗ |
Important
AI Review is run only on demand for your team. We're only showing results of static analysis review right now. To trigger AI Review, comment @deepsourcebot review on this thread.
Up to standards ✅🟢 Issues
|
| Metric | Results |
|---|---|
| Complexity | 0 |
NEW Get contextual insights on your PRs based on Codacy's metrics, along with PR and Jira context, without leaving GitHub. Enable AI reviewer
TIP This summary will be updated as you push new changes.
There was a problem hiding this comment.
Code Review
This pull request updates the misfire_grace_time for the bug_checker job in orchestrator.py to prevent late execution after a restart. Feedback suggests that the 1-second grace time is overly restrictive and could lead to missed jobs due to system jitter, recommending a more robust value like 30 seconds instead.
| CronTrigger(hour=10, minute=0, timezone="America/Los_Angeles"), | ||
| id="bug_checker", | ||
| misfire_grace_time=0, # never fire if restarted after 10 AM — prevents 8 PM surprises | ||
| misfire_grace_time=1, # skip if >1s late (effectively skip on restart) — prevents 8 PM surprises |
There was a problem hiding this comment.
Setting misfire_grace_time=1 is extremely restrictive. A 1-second window is susceptible to minor system jitter or event loop delays, which could cause this daily health check to be skipped even during normal operation. Since the goal is to prevent runs that are hours late (e.g., "8 PM surprises"), a more robust value like 30 or 60 would be safer while still effectively skipping the job if the service was down for a significant period. Note that the global job_defaults already provides a 30 second grace time (line 93), so you could also consider removing this parameter to use that default.
| misfire_grace_time=1, # skip if >1s late (effectively skip on restart) — prevents 8 PM surprises | |
| misfire_grace_time=30, # skip if >30s late (prevents stale runs on restart) — prevents 8 PM surprises |
PR #570 — APScheduler startup crash fix
Root cause
Every Railway deploy since PR #559 fails at startup with:
APScheduler does not accept
0as a valid value — must beNoneor a positive integer.Fix
misfire_grace_time=0→misfire_grace_time=11 second achieves the same behavioral goal: Railway restarts take 30-60 seconds, so any bug_checker job that was scheduled while the service was down will have been missed by >>1s and will be skipped. No 8 PM surprise fires.
Summary by cubic
Fixes a startup crash by setting
misfire_grace_time=1(was 0) for thebug_checkerjob inAPScheduler. This meetsAPScheduler’s requirement for a positive integer and keeps the intended behavior of skipping missed runs after restarts.Written for commit 05651d5. Summary will update on new commits.