MCPcopy Create free account
hub / github.com/block/buzz / scheduleReconnect

Method scheduleReconnect

desktop/src/shared/api/relayClientSession.ts:904–929  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

902 }
903
904 private scheduleReconnect() {
905 if (
906 !shouldScheduleReconnect({
907 terminal: this.terminal,
908 hasPendingReconnect: this.reconnectTimeout !== null,
909 hasLiveSocket: this.wsId !== null,
910 keepAliveRequested: this.keepAliveRequested,
911 hasLiveSubscriptions: this.hasLiveSubscriptions(),
912 })
913 ) {
914 return;
915 }
916
917 const delay = this.reconnectDelayMs;
918 this.reconnectDelayMs = Math.min(
919 this.reconnectDelayMs * 2,
920 RECONNECT_MAX_DELAY_MS,
921 );
922
923 this.reconnectTimeout = window.setTimeout(() => {
924 this.reconnectTimeout = null;
925 void this.ensureConnected().catch(() => {
926 this.scheduleReconnect();
927 });
928 }, delay);
929 }
930
931 private emitReconnectIfNeeded() {
932 const shouldNotifyReconnectListeners =

Callers 1

resetConnectionMethod · 0.95

Calls 3

hasLiveSubscriptionsMethod · 0.95
ensureConnectedMethod · 0.95
shouldScheduleReconnectFunction · 0.90

Tested by

no test coverage detected