File tree Expand file tree Collapse file tree 2 files changed +12
-1
lines changed
Expand file tree Collapse file tree 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) {
218218
219219 function createConnection ( options ) {
220220 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 } )
222224 all . push ( connection )
223225 return connection
224226 }
Original file line number Diff line number Diff line change @@ -317,6 +317,15 @@ t('Login using scram-sha-256', async() => {
317317 return [ true , ( await postgres ( { ...options , ...login_scram } ) `select true as x` ) [ 0 ] . x ]
318318} )
319319
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+
320329t ( 'Support dynamic password function' , async ( ) => {
321330 return [ true , ( await postgres ( {
322331 ...options ,
You can’t perform that action at this time.
0 commit comments