Skip to content

Commit 3ffc3c4

Browse files
committed
Someones engines are getting pedantic - fixes #1061
1 parent 3a43815 commit 3ffc3c4

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/connection.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
8484
, statements = {}
8585
, statementId = Math.random().toString(36).slice(2)
8686
, statementCount = 1
87-
, closedDate = 0
87+
, closedTime = 0
8888
, remaining = 0
8989
, hostIndex = 0
9090
, retries = 0
@@ -353,7 +353,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
353353
}
354354

355355
function reconnect() {
356-
setTimeout(connect, closedDate ? closedDate + delay - performance.now() : 0)
356+
setTimeout(connect, closedTime ? Math.max(0, closedTime + delay - performance.now()) : 0)
357357
}
358358

359359
function connected() {
@@ -445,7 +445,7 @@ function Connection(options, queues = {}, { onopen = noop, onend = noop, onclose
445445
return reconnect()
446446

447447
!hadError && (query || sent.length) && error(Errors.connection('CONNECTION_CLOSED', options, socket))
448-
closedDate = performance.now()
448+
closedTime = performance.now()
449449
hadError && options.shared.retries++
450450
delay = (typeof backoff === 'function' ? backoff(options.shared.retries) : backoff) * 1000
451451
onclose(connection, Errors.connection('CONNECTION_CLOSED', options, socket))

0 commit comments

Comments
 (0)