Skip to content

PR #570: Fix misfire_grace_time=0 → 1 (APScheduler crash on startup)#439

Merged
jaayslaughter-cpu merged 1 commit into
mainfrom
pr-570-misfire-fix
May 15, 2026
Merged

PR #570: Fix misfire_grace_time=0 → 1 (APScheduler crash on startup)#439
jaayslaughter-cpu merged 1 commit into
mainfrom
pr-570-misfire-fix

Conversation

@jaayslaughter-cpu
Copy link
Copy Markdown
Owner

@jaayslaughter-cpu jaayslaughter-cpu commented May 15, 2026

PR #570 — APScheduler startup crash fix

Root cause

Every Railway deploy since PR #559 fails at startup with:

TypeError: misfire_grace_time must be either None or a positive integer
  File "/app/orchestrator.py", line 721
    scheduler.add_job(..., misfire_grace_time=0, ...)

APScheduler does not accept 0 as a valid value — must be None or a positive integer.

Fix

misfire_grace_time=0misfire_grace_time=1

1 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 the bug_checker job in APScheduler. This meets APScheduler’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.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented May 15, 2026

Warning

Rate limit exceeded

@jaayslaughter-cpu has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 43 minutes and 32 seconds before requesting another review.

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 @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

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.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: e48a2840-1569-4300-a120-21533521c8a7

📥 Commits

Reviewing files that changed from the base of the PR and between e5f9a20 and 05651d5.

📒 Files selected for processing (1)
  • orchestrator.py
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch pr-570-misfire-fix

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@deepsource-io
Copy link
Copy Markdown

deepsource-io Bot commented May 15, 2026

DeepSource Code Review

We reviewed changes in e5f9a20...05651d5 on this pull request. Below is the summary for the review, and you can see the individual issues we found as inline review comments.

See full review on DeepSource ↗

PR Report Card

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.

@jaayslaughter-cpu jaayslaughter-cpu merged commit 95671fa into main May 15, 2026
7 of 9 checks passed
Copy link
Copy Markdown
Contributor

@cubic-dev-ai cubic-dev-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No issues found across 1 file

@codacy-production
Copy link
Copy Markdown

Up to standards ✅

🟢 Issues 0 issues

Results:
0 new issues

View in Codacy

🟢 Metrics 0 complexity

Metric Results
Complexity 0

View in Codacy

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.

Copy link
Copy Markdown

@gemini-code-assist gemini-code-assist Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread orchestrator.py
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
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

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.

Suggested change
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

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.

1 participant