From b1b39c7d9ffaaaacddf497334776a6c55237b25c Mon Sep 17 00:00:00 2001 From: James Ross Date: Fri, 31 Jan 2025 15:48:40 +0000 Subject: [PATCH 1/2] fix: default connections in cloudflare to lower --- cf/src/index.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cf/src/index.js b/cf/src/index.js index d24e9f9c..d41faac5 100644 --- a/cf/src/index.js +++ b/cf/src/index.js @@ -446,7 +446,7 @@ function parseOptions(a, b) { const ints = ['idle_timeout', 'connect_timeout', 'max_lifetime', 'max_pipeline', 'backoff', 'keep_alive'] const defaults = { - max : 10, + max : 3, ssl : false, idle_timeout : null, connect_timeout : 30, From 0e3626bd0c053054f3b085f9d9577964aa2e9999 Mon Sep 17 00:00:00 2001 From: James Ross Date: Sun, 2 Feb 2025 18:19:06 +0000 Subject: [PATCH 2/2] feat: change max connections in cf build script --- cf/src/index.js | 2 +- transpile.cf.js | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/cf/src/index.js b/cf/src/index.js index d41faac5..2f28dfb4 100644 --- a/cf/src/index.js +++ b/cf/src/index.js @@ -481,7 +481,7 @@ function parseOptions(a, b) { {} ), connection : { - application_name: 'postgres.js', + application_name: env.PGAPPNAME || 'postgres.js', ...o.connection, ...Object.entries(query).reduce((acc, [k, v]) => (k in defaults || (acc[k] = v), acc), {}) }, diff --git a/transpile.cf.js b/transpile.cf.js index bbe4c500..ea7f6bbd 100644 --- a/transpile.cf.js +++ b/transpile.cf.js @@ -36,4 +36,5 @@ function transpile(x) { .replace('import fs from \'fs\'', 'import { fs } from \'../polyfills.js\'') .replace('import { performance } from \'perf_hooks\'', 'import { performance } from \'../polyfills.js\'') .replace(/ from '([a-z_]+)'/g, ' from \'node:$1\'') + .replace(/(\s*max\s*:\s*)10+/, '$13') // https://github.com/porsager/postgres/issues/1023 }