Fix Sendspin reconnect races and add initial visualizer role support#3431
Fix Sendspin reconnect races and add initial visualizer role support#3431MarvinSchenkel merged 10 commits intodevfrom
Conversation
When a client reconnects with a changed hello payload, refresh the player's device info and state without a full reattach cycle.
🔒 Dependency Security Report📦 Modified Dependencies
|
There was a problem hiding this comment.
Pull request overview
This PR updates the Sendspin integration to aiosendspin==4.4.0, adds handling for refreshed client “hello” attributes (including the draft visualizer role), and hardens Sendspin player registration/unregistration against quick reconnect race conditions by discarding stale tasks.
Changes:
- Bump
aiosendspinto4.4.0in both global requirements and the Sendspin provider manifest. - Add per-client event versioning/task tracking in the Sendspin provider to skip stale add/remove work and reduce reconnect races.
- Add
ClientUpdatedEventhandling and refactorSendspinPlayerto refresh attributes from updated hello payloads and manage event subscriptions more safely.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
requirements_all.txt |
Updates pinned aiosendspin dependency to 4.4.0. |
music_assistant/providers/sendspin/manifest.json |
Updates provider-level requirement pin for aiosendspin to 4.4.0. |
music_assistant/providers/sendspin/provider.py |
Adds stale-task suppression for add/remove and introduces client-updated handling. |
music_assistant/providers/sendspin/player.py |
Adds refreshable hello-derived attributes and consolidates subscribe/unsubscribe logic for callbacks. |
This is now handled internally by `register_or_update`.
There was a problem hiding this comment.
Pull request overview
This PR updates the Sendspin provider to reduce reconnect race conditions by discarding stale add/remove work, and bumps the Sendspin client library to pick up refreshed-hello handling and initial draft visualizer role availability.
Changes:
- Bump
aiosendspinfrom4.3.4to4.4.0in both the global requirements and the Sendspin provider manifest. - Add per-client event versioning/in-flight bookkeeping to skip stale add/remove tasks during rapid reconnects.
- Add handling for
ClientUpdatedEventto refresh player attributes when the client hello payload changes.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| requirements_all.txt | Updates pinned aiosendspin version to 4.4.0. |
| music_assistant/providers/sendspin/provider.py | Adds stale-task prevention for reconnect races and handles ClientUpdatedEvent. |
| music_assistant/providers/sendspin/player.py | Adds callback subscribe/unsubscribe helpers and supports refreshing player attributes from updated client info. |
| music_assistant/providers/sendspin/manifest.json | Updates provider-scoped aiosendspin requirement to 4.4.0. |
Comments suppressed due to low confidence (1)
music_assistant/providers/sendspin/provider.py:259
unload()sets_unloading = Truebut does not cancel/await any in-flight add/remove tasks that already passed the_unloadingcheck, so they can still run and (re-)register/unregister players after the provider has started unloading. Consider tracking the created client-event tasks (e.g., withtask_idper client) and cancelling/awaiting them during unload, and/or re-check_unloadingafter awaits inside the handlers before mutating player registration state.
self._unloading = True
player_ids = [player.player_id for player in self.players]
# Disconnect all clients before stopping the server
clients = list(self.server_api.clients)
connected_clients = []
disconnect_tasks = []
…3431) * fix(sendspin): harden reconnect lifecycle * feat: handle `ClientUpdatedEvent` in sendspin provider When a client reconnects with a changed hello payload, refresh the player's device info and state without a full reattach cycle. * chore(sendspin): bump aiosendspin to 4.4.0 * fix(sendspin): preserve client-updated player state * refactor(sendspin): drop direct `_evaluate_protocol_links` call This is now handled internally by `register_or_update`. * fix(sendspin): guard `_handle_client_updated` against unload * fix(sendspin): check for stale event before registering player * fix(sendspin): preserve reconnect state across client events * fix(sendspin): preserve bridge identity on client update
…3431) * fix(sendspin): harden reconnect lifecycle * feat: handle `ClientUpdatedEvent` in sendspin provider When a client reconnects with a changed hello payload, refresh the player's device info and state without a full reattach cycle. * chore(sendspin): bump aiosendspin to 4.4.0 * fix(sendspin): preserve client-updated player state * refactor(sendspin): drop direct `_evaluate_protocol_links` call This is now handled internally by `register_or_update`. * fix(sendspin): guard `_handle_client_updated` against unload * fix(sendspin): check for stale event before registering player * fix(sendspin): preserve reconnect state across client events * fix(sendspin): preserve bridge identity on client update
Sendspin players that reconnect quickly could hit race conditions in some cases. This is now fixed by discarding stale add/remove tasks.
Additionally, updates
aiosendspinto 4.4.0 with:visualizer@_draft_r1role is now available for Sendspin clients. Implements this draft version of the spec (from this PR) with these limitations.