MCPcopy Create free account
hub / github.com/bigskysoftware/_hyperscript / scheduleReconnect

Function scheduleReconnect

src/ext/eventsource.js:315–325  ·  view source on GitHub ↗
(stub, baseDelay)

Source from the content-addressed store, hash-verified

313}
314
315function scheduleReconnect(stub, baseDelay) {
316 if (stub.closed) return;
317 baseDelay = baseDelay || 500;
318
319 stub.retryCount = Math.min(7, stub.retryCount + 1);
320 var timeout = Math.random() * (2 ** stub.retryCount) * baseDelay;
321 stub.reconnectTimeout = setTimeout(function () {
322 stub.reconnectTimeout = null;
323 if (!stub.closed) startConnection(stub);
324 }, timeout);
325}
326
327// ========================================
328// EVENT DISPATCH

Callers 2

startConnectionFunction · 0.70
readStreamFunction · 0.70

Calls 2

startConnectionFunction · 0.70
setTimeoutFunction · 0.50

Tested by

no test coverage detected