diff --git a/cf/src/connection.js b/cf/src/connection.js index 203af80d..3bfd847d 100644 --- a/cf/src/connection.js +++ b/cf/src/connection.js @@ -352,7 +352,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose } function reconnect() { - setTimeout(connect, closedDate ? closedDate + delay - performance.now() : 0) + setTimeout(connect, Math.max(closedDate ? closedDate + delay - performance.now() : 0, 0)) } function connected() { diff --git a/cjs/src/connection.js b/cjs/src/connection.js index 589d3638..6493e0b8 100644 --- a/cjs/src/connection.js +++ b/cjs/src/connection.js @@ -350,7 +350,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose } function reconnect() { - setTimeout(connect, closedDate ? closedDate + delay - performance.now() : 0) + setTimeout(connect, Math.max(closedDate ? closedDate + delay - performance.now() : 0, 0)) } function connected() { diff --git a/deno/src/connection.js b/deno/src/connection.js index a3f43c48..31718b3e 100644 --- a/deno/src/connection.js +++ b/deno/src/connection.js @@ -353,7 +353,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose } function reconnect() { - setTimeout(connect, closedDate ? closedDate + delay - performance.now() : 0) + setTimeout(connect, Math.max(closedDate ? closedDate + delay - performance.now() : 0, 0)) } function connected() { diff --git a/src/connection.js b/src/connection.js index c3f554aa..1fe344e7 100644 --- a/src/connection.js +++ b/src/connection.js @@ -350,7 +350,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose } function reconnect() { - setTimeout(connect, closedDate ? closedDate + delay - performance.now() : 0) + setTimeout(connect, Math.max(closedDate ? closedDate + delay - performance.now() : 0, 0)) } function connected() {