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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

Recover faster after network outage
2 participants