Skip to content

v28 — kill the 30-60s Spotify Connect delay

Choose a tag to compare

@CheapDevotion CheapDevotion released this 09 May 23:43
· 5 commits to main since this release

What's in v28

Spotify Connect device pickups now consistently complete in 1-2 seconds instead of 30-60.

Root cause

The kiosk's first session-creation attempt occasionally fails on the TCP connect to a Spotify accesspoint (random pick from a 6-AP pool, some are intermittently unreachable). The phone-side Connect protocol then waits ~33 seconds before re-sending /addUser, which is the user-visible delay. Identified via fleet logs from `get_logs`:

```
16:30:22.143 Accepted new user from iPhone
16:30:22.959 ERROR ZeroconfServer - Couldn't establish a new session.
(33s of phone-side retry timeout)
16:30:55.006 Accepted new user from iPhone ← retry, succeeds
```

Fix

Patched librespot's `ZeroconfServer.handleAddUser` (in our local clone) to retry session creation up to 5 times with 200ms backoff before giving up. Each retry picks a fresh random AP, so a different one is tried. With 6 APs in the typical pool and most working, retries usually succeed on attempt 2.

Worst case: ~5s before giving up. Still vastly better than the 33s phone-side timeout.