File tree Expand file tree Collapse file tree 1 file changed +10
-0
lines changed
packages/ocap-kernel/src/remotes Expand file tree Collapse file tree 1 file changed +10
-0
lines changed Original file line number Diff line number Diff line change @@ -805,6 +805,16 @@ export async function initNetwork(
805805 // Re-fetch queue in case cleanupStalePeers deleted it during the await
806806 const currentQueue = getMessageQueue ( targetPeerId ) ;
807807 currentQueue . enqueue ( message ) ;
808+
809+ // If a new channel is active (stale channel was replaced by inbound connection),
810+ // flush the queue on it to prevent messages from being stuck indefinitely
811+ const newChannel = channels . get ( targetPeerId ) ;
812+ if ( newChannel && newChannel !== channel ) {
813+ logger . log (
814+ `${ targetPeerId } :: stale channel replaced, flushing queue on new channel` ,
815+ ) ;
816+ await flushQueuedMessages ( targetPeerId , newChannel , currentQueue ) ;
817+ }
808818 }
809819 }
810820
You can’t perform that action at this time.
0 commit comments