Deployment and lifecycle management for Nix
0
fork

Configure Feed

Select the types of activity you want to include in your feed.

fix: only invalidate cached token on auth rejection, not all disconnects

Narrow token invalidation to only fire when the server returns 401/403
(upgrade_failure), indicating the token or OAuth client is invalid.
Normal disconnects (server restart, network blip) no longer force an
unnecessary HTTP reauthentication.

sow-157

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>

+12 -1
+12 -1
apps/garden/lib/garden/socket.ex
··· 128 128 end 129 129 130 130 @impl Slipstream 131 + def handle_disconnect({:error, {:upgrade_failure, %{status_code: status}}} = reason, socket) 132 + when status in [403, 401] do 133 + Logger.warning( 134 + msg: "Server rejected connection, invalidating cached token", 135 + status: status, 136 + reason: inspect(reason) 137 + ) 138 + 139 + invalidate_cached_token() 140 + {:ok, schedule_reconnect(socket)} 141 + end 142 + 131 143 def handle_disconnect(reason, socket) do 132 144 Logger.warning(msg: "Disconnected from server socket", reason: inspect(reason)) 133 - invalidate_cached_token() 134 145 {:ok, schedule_reconnect(socket)} 135 146 end 136 147