From 8c97038d763cae93ba156dc9a10adf1e34cc8c60 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 25 Aug 2025 21:55:54 +0000 Subject: [PATCH 1/4] Initial plan From 930a11b50543cf95ec701ba37af29531165ea76e Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 25 Aug 2025 21:58:45 +0000 Subject: [PATCH 2/4] Initial setup - analyze TimeoutNegativeWarning issue Co-authored-by: paulhenri-l <25308170+paulhenri-l@users.noreply.github.com> --- deno/src/index.js | 2 +- package-lock.json | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+), 1 deletion(-) create mode 100644 package-lock.json diff --git a/deno/src/index.js b/deno/src/index.js index aa7a920f..98a82345 100644 --- a/deno/src/index.js +++ b/deno/src/index.js @@ -482,8 +482,8 @@ function parseOptions(a, b) { {} ), connection : { + application_name: env.PGAPPNAME || 'postgres.js', ...o.connection, - application_name: o.connection?.application_name ?? env.PGAPPNAME ?? 'postgres.js', ...Object.entries(query).reduce((acc, [k, v]) => (k in defaults || (acc[k] = v), acc), {}) }, types : o.types || {}, diff --git a/package-lock.json b/package-lock.json new file mode 100644 index 00000000..7b60ad27 --- /dev/null +++ b/package-lock.json @@ -0,0 +1,20 @@ +{ + "name": "postgres", + "version": "3.4.7", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "postgres", + "version": "3.4.7", + "license": "Unlicense", + "engines": { + "node": ">=12" + }, + "funding": { + "type": "individual", + "url": "https://github.com/sponsors/porsager" + } + } + } +} From 10b2053d84a0a825203fbf7e5382d769c3a37ffa Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 25 Aug 2025 22:01:18 +0000 Subject: [PATCH 3/4] Fix TimeoutNegativeWarning in reconnect function by using Math.max Co-authored-by: paulhenri-l <25308170+paulhenri-l@users.noreply.github.com> --- cf/src/connection.js | 2 +- cjs/src/connection.js | 2 +- deno/src/connection.js | 2 +- src/connection.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) 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() { From f5f0bc79fd2aaa761c6a644a6392c4c949fd6ca6 Mon Sep 17 00:00:00 2001 From: "copilot-swe-agent[bot]" <198982749+Copilot@users.noreply.github.com> Date: Mon, 25 Aug 2025 22:15:46 +0000 Subject: [PATCH 4/4] Remove out-of-scope changes: revert deno/src/index.js and remove package-lock.json Co-authored-by: paulhenri-l <25308170+paulhenri-l@users.noreply.github.com> --- deno/src/index.js | 2 +- package-lock.json | 20 -------------------- 2 files changed, 1 insertion(+), 21 deletions(-) delete mode 100644 package-lock.json diff --git a/deno/src/index.js b/deno/src/index.js index 98a82345..aa7a920f 100644 --- a/deno/src/index.js +++ b/deno/src/index.js @@ -482,8 +482,8 @@ function parseOptions(a, b) { {} ), connection : { - application_name: env.PGAPPNAME || 'postgres.js', ...o.connection, + application_name: o.connection?.application_name ?? env.PGAPPNAME ?? 'postgres.js', ...Object.entries(query).reduce((acc, [k, v]) => (k in defaults || (acc[k] = v), acc), {}) }, types : o.types || {}, diff --git a/package-lock.json b/package-lock.json deleted file mode 100644 index 7b60ad27..00000000 --- a/package-lock.json +++ /dev/null @@ -1,20 +0,0 @@ -{ - "name": "postgres", - "version": "3.4.7", - "lockfileVersion": 3, - "requires": true, - "packages": { - "": { - "name": "postgres", - "version": "3.4.7", - "license": "Unlicense", - "engines": { - "node": ">=12" - }, - "funding": { - "type": "individual", - "url": "https://github.com/sponsors/porsager" - } - } - } -}