You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
fix(sync): close the server websocket once background data sync finishes #2212
The Exchange screen no longer disconnects the archive server websocket on blur while data sync is still in progress (see the linked pull request), so an upload can finish in the background. After that nothing on the phone closes the socket: core's $sync.stop() and the autostop only clear wantsToSyncData, and disconnectServers() has no caller outside the Exchange screen. The socket stays open, idle on core's keepalive, until the user next visits and leaves the screen or the process dies. This mirrors how local peer sync is left running off-screen, but it is a change in how long the server connection lives.
The connection needs an owner that outlives the screen, for example a hook in the active-project provider that calls projectApi.$sync.disconnectServers() when the sync state reaches complete-full or data sync is turned off (by the autostop or an explicit stop). The Exchange screen's own blur handling would then only need to cover the "sync not enabled" case.
Resolved in core rather than in the app: digidem/comapeo-core#1360 makes $sync.disconnectServers() close each server socket once sync with it has finished, bounded by a 15 s idle timeout, with connectServers() cancelling a pending disconnect. With that, the Exchange screen's unconditional disconnect on blur (#2213 as it now stands) always ends the socket, so no owner outliving the screen is needed. This can close once the app is on a core release that includes it.
Activity
gmaclennan commentedon Nov 6, 2026
Resolved in core rather than in the app: digidem/comapeo-core#1360 makes
$sync.disconnectServers()close each server socket once sync with it has finished, bounded by a 15 s idle timeout, withconnectServers()cancelling a pending disconnect. With that, the Exchange screen's unconditional disconnect on blur (#2213 as it now stands) always ends the socket, so no owner outliving the screen is needed. This can close once the app is on a core release that includes it.