Files
flutter/lib/core/network
Ben Tucker 57fe12677c fix(auth): do not await PowerSync disconnect during session clear
A rejected refresh token runs clearSessionOnly inside the single-flight
refresh future. PowerSync's disconnect can block on an in-flight sync
fetch that is itself awaiting that same refresh future through
AuthHttpClient's pre-emptive refresh, closing a three-party cycle
(refresh -> disconnect -> sync fetch -> refresh) that permanently wedges
every authenticated request behind the never-completing refresh. The
session-expired message never appears because it is sequenced after the
hanging call, and an app restart re-triggers the same rejected refresh
during startup revalidation, so the deadlock re-forms immediately.

On the keep-data path the DB is not wiped, so there is no re-attach race
to guard against; the disconnect is only a courtesy stop of the sync
loop and is now fire-and-forget. The wipe path (explicit logout) keeps
its ordering. The disconnect hook is injectable for tests because
PowerSyncDatabase is a base class that cannot be faked.
2026-08-12 19:08:24 -05:00
..
2026-07-01 20:28:06 +02:00