File tree Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Expand file tree Collapse file tree 1 file changed +12
-10
lines changed Original file line number Diff line number Diff line change @@ -474,22 +474,24 @@ export function runTaskListInternal(
474
474
}
475
475
}
476
476
477
- function release ( ) {
477
+ async function release ( ) {
478
478
// No need to call changeListener.release() because the client errored
479
479
changeListener = null ;
480
480
client . removeListener ( "notification" , handleNotification ) ;
481
481
// TODO: ideally we'd only stop handling errors once all pending queries are complete; but either way we shouldn't try again!
482
482
client . removeListener ( "error" , onErrorReleaseClientAndTryAgain ) ;
483
483
events . emit ( "pool:listen:release" , { workerPool, client } ) ;
484
- return client
485
- . query ( 'UNLISTEN "jobs:insert"; UNLISTEN "worker:migrate";' )
486
- . catch ( ( error ) => {
487
- /* ignore errors */
488
- logger . error ( `Error occurred attempting to UNLISTEN: ${ error } ` , {
489
- error,
490
- } ) ;
491
- } )
492
- . then ( ( ) => releaseClient ( ) ) ;
484
+ try {
485
+ await client . query (
486
+ 'UNLISTEN "jobs:insert"; UNLISTEN "worker:migrate";' ,
487
+ ) ;
488
+ } catch ( error ) {
489
+ /* ignore errors */
490
+ logger . error ( `Error occurred attempting to UNLISTEN: ${ error } ` , {
491
+ error,
492
+ } ) ;
493
+ }
494
+ return releaseClient ( ) ;
493
495
}
494
496
495
497
// On error, release this client and try again
You can’t perform that action at this time.
0 commit comments