Skip to content

fix: recover faster after network outage (fixes #49) #131

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Jun 23, 2025

Conversation

Hany-Almnaem
Copy link
Contributor

This PR improves SPARK's ability to recover quickly after network outages.

Changes:

  • Introduces ActivityState.isHealthy() to expose health state
  • Modifies spark.js#run() to:
    • Retry every 5 seconds when offline (OFFLINE_RETRY_DELAY_MS)
    • Use jittered delay when healthy (via calculateDelayBeforeNextTask)
  • Adds a test case to verify offline retry delay

This makes the station feel more responsive after waking from sleep or reconnecting.

All tests pass
Fixes #49

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

Thank you for the pull request, @Hany-Almnaem! This will be a great and impactful improvement. ❤️

Copy link
Member

@bajtos bajtos left a comment

Choose a reason for hiding this comment

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

Almost there!

@bajtos bajtos merged commit 3c5219c into CheckerNetwork:main Jun 23, 2025
7 checks passed
@github-project-automation github-project-automation bot moved this to ✅ done in CheckerNetwork Jun 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: ✅ done
Development

Successfully merging this pull request may close these issues.

Recover faster after network outage
2 participants