@@ -11,7 +11,12 @@ export class PostgresClient {
1111 pool : pg . Pool ;
1212
1313 constructor ( private config : PostgresConfig ) {
14- this . pool = new pg . Pool ( { connectionString : config . databaseUrl , max : 25 , keepAlive : true } ) ;
14+ this . pool = new pg . Pool ( {
15+ connectionString : config . databaseUrl ,
16+ max : 25 ,
17+ keepAlive : true ,
18+ application_name : 'orb-sync-engine' ,
19+ } ) ;
1520 }
1621
1722 async upsertMany <
@@ -51,12 +56,7 @@ export class PostgresClient {
5156 T extends {
5257 [ Key : string ] : any ; // eslint-disable-line @typescript-eslint/no-explicit-any
5358 } ,
54- > (
55- entries : T [ ] ,
56- table : string ,
57- tableSchema : JsonSchema ,
58- syncTimestamp : string
59- ) : Promise < T [ ] > {
59+ > ( entries : T [ ] , table : string , tableSchema : JsonSchema , syncTimestamp : string ) : Promise < T [ ] > {
6060 if ( ! entries . length ) return [ ] ;
6161
6262 // Max 5 in parallel to avoid exhausting connection pool
@@ -72,12 +72,8 @@ export class PostgresClient {
7272 const cleansed = this . cleanseArrayField ( entry , tableSchema ) ;
7373 // Add last_synced_at to the cleansed data for SQL parameter binding
7474 cleansed . last_synced_at = syncTimestamp ;
75-
76- const upsertSql = this . constructUpsertWithTimestampProtectionSql (
77- this . config . schema ,
78- table ,
79- tableSchema
80- ) ;
75+
76+ const upsertSql = this . constructUpsertWithTimestampProtectionSql ( this . config . schema , table , tableSchema ) ;
8177
8278 const prepared = sql ( upsertSql , {
8379 useNullForMissing : true ,
0 commit comments