Comparing version 2.0.0-beta.10 to 2.0.0-beta.11
@@ -355,4 +355,6 @@ const net = require('net') | ||
let i = 0 | ||
let retries = 0 | ||
function onclose(err) { | ||
retries++ | ||
oncleanup() | ||
@@ -362,3 +364,3 @@ !ended && !succeeded && i < options.host.length | ||
: err instanceof Error | ||
? error(err) | ||
? (error(err), close()) | ||
: close() | ||
@@ -378,6 +380,10 @@ i >= options.host.length && (i = 0) | ||
function connect() { | ||
async function connect() { | ||
if (!closed) | ||
return | ||
retries && await new Promise(r => | ||
setTimeout(r, Math.min((0.5 + Math.random()) * Math.pow(1.3, retries) * 10, 10000)) | ||
) | ||
closed = succeeded = false | ||
@@ -425,2 +431,3 @@ | ||
function ready() { | ||
retries = 0 | ||
try { | ||
@@ -436,2 +443,3 @@ socket.write(frontend.StartupMessage(options)) | ||
success: () => { | ||
retries = 0 | ||
succeeded = true | ||
@@ -438,0 +446,0 @@ i >= options.host.length && (i = 0) |
{ | ||
"name": "postgres", | ||
"version": "2.0.0-beta.10", | ||
"version": "2.0.0-beta.11", | ||
"description": "Fastest full featured PostgreSQL client for Node.js", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
97333
2291