Skip to content

Commit 27bc653

Browse files
committed
fix: reduce number of clients in pool
Signed-off-by: Maud Royer <[email protected]>
1 parent f4af9f6 commit 27bc653

File tree

1 file changed

+16
-12
lines changed

1 file changed

+16
-12
lines changed

src/db/index.ts

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,22 @@ export type LeafletImage = Selectable<LeafletImagesTable>;
3737

3838
const db = new Kysely<Database>({
3939
dialect: new PostgresDialect({
40-
pool: process.env.DATABASE_URL
41-
? new Pool({ connectionString: process.env.DATABASE_URL })
42-
: new Pool({
43-
// .devcontainer config
44-
database: "postgres",
45-
host: "db-postgres",
46-
user: "postgres",
47-
password: "postgres",
48-
port: 5432,
49-
max: 5,
50-
connectionTimeoutMillis: 5000,
51-
}),
40+
pool: new Pool({
41+
...(process.env.DATABASE_URL
42+
? {
43+
connectionString: process.env.DATABASE_URL,
44+
}
45+
: {
46+
// .devcontainer config
47+
database: "postgres",
48+
host: "db-postgres",
49+
user: "postgres",
50+
password: "postgres",
51+
port: 5432,
52+
}),
53+
max: 5,
54+
connectionTimeoutMillis: 5000,
55+
}),
5256
}),
5357
});
5458

0 commit comments

Comments
 (0)