Skip to content

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