mirror of
https://github.com/aljazceru/ditto.git
synced 2025-12-26 09:44:25 +01:00
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:
@@ -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>) {
|
||||
|
||||
Reference in New Issue
Block a user