File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 11import { readFile } from "node:fs/promises" ;
2+ import { isMainThread } from "node:worker_threads" ;
23import { drizzle } from "drizzle-orm/postgres-js" ;
34import postgres from "postgres" ;
45
56import * as schema from "./schema.js" ;
67
8+ const SERVER_POOL_MAX = 32 ;
9+ const WORKER_POOL_MAX = 16 ;
10+ const IDLE_TIMEOUT_SECONDS = 30 ;
11+
712let PG_PASSWORD = process . env . PG_PASSWORD ;
813
914const PG_PASSWORD_FILE = process . env . PG_PASSWORD_FILE ;
@@ -17,8 +22,8 @@ const connection = postgres({
1722 password : PG_PASSWORD ,
1823 database : process . env . PG_DATABASE ,
1924 path : process . env . PG_PATH ,
20- max : 25 ,
21- idle_timeout : 120 ,
25+ max : isMainThread ? SERVER_POOL_MAX : WORKER_POOL_MAX ,
26+ idle_timeout : IDLE_TIMEOUT_SECONDS ,
2227} ) ;
2328
2429export const database = drizzle ( connection , {
Original file line number Diff line number Diff line change @@ -80,7 +80,7 @@ export async function handleVehicleBatch(vehicleJourneys: VehicleJourney[]) {
8080 }
8181
8282 if ( network . hasVehiclesFeature ) {
83- registerActivities ( registerableActivities ) ;
83+ await registerActivities ( registerableActivities ) ;
8484 }
8585 }
8686
You can’t perform that action at this time.
0 commit comments