Fix August API ETIMEDOUT errors after 24 hours with session refresh and retry logic #166
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR addresses persistent ETIMEDOUT connection failures that occur after approximately 24 hours of plugin operation. The issue manifests as:
Root Cause
The August API invalidates sessions after extended periods, but the plugin continued using stale connections without attempting to re-establish them when timeouts occurred.
Solution
Implemented a minimal timeout detection and session refresh mechanism:
isTimeoutError()
method to specifically identify ETIMEDOUT errors in network operationsrefreshAugustSession()
method that callsaugustConfig.end()
to clear stale tokens, forcing re-authentication on the next API callrefreshStatus()
andpushChanges()
methods to automatically retry operations once after session refresh when timeouts are detectedTechnical Details
The fix leverages the existing
august-yale
library's session management:augustConfig.end()
to clear stale tokensTesting
The solution is minimal and surgical, adding only 64 lines of code focused specifically on timeout handling without modifying any existing behavior.
Fixes #126.
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.