feat(websocket): interruptable wait timeout#1085
Open
gabsuren wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Based on #607
Previously, calling
esp_websocket_client_set_reconnect_timeout()while a reconnection delay was already in progress had no immediate effect this made dynamic backoff strategies unreliable.Note
Medium Risk
Touches the websocket client task’s reconnect timing and FreeRTOS event-group waits; behavior change is localized but affects all auto-reconnect users who change timeout at runtime.
Overview
Reconnect backoff can now be updated while a delay is already running, so dynamic strategies (e.g. exponential backoff on
WEBSOCKET_EVENT_DISCONNECTED) take effect immediately instead of waiting for the old fixed sleep to finish.The client task adds a
WAKEUP_BITon the status event group.esp_websocket_client_set_reconnect_timeout()sets this bit after updatingwait_timeout_ms, which ends the reconnect wait early. The wait loop no longer blocks for half ofwait_timeout_mson a fixed timer; it sleeps only for the remaining time until reconnect (or until stop/WAKEUP_BIT). Reconnect eligibility uses>=withuint64_tfor the elapsed-vs-timeout comparison. Public API docs drop the old “may not affect active delay” warning and state that an in-progress delay is updated.Reviewed by Cursor Bugbot for commit 2469f63. Bugbot is set up for automated code reviews on this repo. Configure here.