File tree 2 files changed +12
-1
lines changed
2 files changed +12
-1
lines changed Original file line number Diff line number Diff line change @@ -218,7 +218,9 @@ function Postgres(a, b) {
218
218
219
219
function createConnection ( options ) {
220
220
slots --
221
- const connection = Connection ( options )
221
+ // The options object gets cloned as the as the authentication in the frontend.js mutates the
222
+ // options to persist a nonce and signature, which are unique per connection.
223
+ const connection = Connection ( { ...options } )
222
224
all . push ( connection )
223
225
return connection
224
226
}
Original file line number Diff line number Diff line change @@ -317,6 +317,15 @@ t('Login using scram-sha-256', async() => {
317
317
return [ true , ( await postgres ( { ...options , ...login_scram } ) `select true as x` ) [ 0 ] . x ]
318
318
} )
319
319
320
+ t ( 'Parallel connections using scram-sha-256' , async ( ) => {
321
+ const sql = postgres ( { ...options , ...login_scram } )
322
+ return [ true , ( await Promise . all ( [
323
+ sql `select true as x, pg_sleep(0.2)` ,
324
+ sql `select true as x, pg_sleep(0.2)` ,
325
+ sql `select true as x, pg_sleep(0.2)`
326
+ ] ) ) [ 0 ] [ 0 ] . x ]
327
+ } )
328
+
320
329
t ( 'Support dynamic password function' , async ( ) => {
321
330
return [ true , ( await postgres ( {
322
331
...options ,
You can’t perform that action at this time.
0 commit comments