Merge branch 'pg-pool-size' into 'main'
Add PG_POOL_SIZE environment variable See merge request soapbox-pub/ditto!233
This commit is contained in:
commit
dbe22b9710
|
@ -208,6 +208,13 @@ class Conf {
|
|||
}
|
||||
},
|
||||
};
|
||||
/** Postgres settings. */
|
||||
static pg = {
|
||||
/** Number of connections to use in the pool. */
|
||||
get poolSize(): number {
|
||||
return Number(Deno.env.get('PG_POOL_SIZE') ?? 10);
|
||||
},
|
||||
};
|
||||
}
|
||||
|
||||
const optionalBooleanSchema = z
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import { Kysely, PostgresAdapter, PostgresIntrospector, PostgresQueryCompiler } from 'kysely';
|
||||
import { PostgreSQLDriver } from 'kysely_deno_postgres';
|
||||
|
||||
import { Conf } from '@/config.ts';
|
||||
import { DittoTables } from '@/db/DittoTables.ts';
|
||||
|
||||
export class DittoPostgres {
|
||||
|
@ -18,7 +19,7 @@ export class DittoPostgres {
|
|||
createDriver() {
|
||||
return new PostgreSQLDriver(
|
||||
{ connectionString: Deno.env.get('DATABASE_URL') },
|
||||
navigator.hardwareConcurrency,
|
||||
Conf.pg.poolSize,
|
||||
);
|
||||
},
|
||||
createIntrospector(db: Kysely<unknown>) {
|
||||
|
|
Loading…
Reference in New Issue