File tree Expand file tree Collapse file tree 3 files changed +11
-8
lines changed
packages/client/lib/client Expand file tree Collapse file tree 3 files changed +11
-8
lines changed Original file line number Diff line number Diff line change @@ -841,13 +841,14 @@ describe('Client', () => {
841
841
quitPromise = client . quit ( ) ;
842
842
assert . equal ( client . isOpen , false ) ;
843
843
844
- const [ ping ] = await Promise . all ( [
844
+ const [ ping , quit ] = await Promise . all ( [
845
845
pingPromise ,
846
- assert . doesNotReject ( quitPromise ) ,
846
+ quitPromise ,
847
847
assert . rejects ( client . ping ( ) , ClientClosedError )
848
848
] ) ;
849
849
850
850
assert . equal ( ping , 'PONG' ) ;
851
+ assert . equal ( quit , 'OK' ) ;
851
852
} , {
852
853
...GLOBAL . SERVERS . OPEN ,
853
854
disableClientSetup : true
Original file line number Diff line number Diff line change @@ -586,16 +586,17 @@ export default class RedisClient<
586
586
587
587
pUnsubscribe = this . PUNSUBSCRIBE ;
588
588
589
- QUIT ( ) : Promise < void > {
590
- return this . #socket. quit ( ( ) => {
591
- const quitPromise = this . #queue. addCommand ( [ 'QUIT' ] , {
589
+ QUIT ( ) : Promise < string > {
590
+ return this . #socket. quit ( async ( ) => {
591
+ const quitPromise = this . #queue. addCommand < string > ( [ 'QUIT' ] , {
592
592
ignorePubSubMode : true
593
593
} ) ;
594
594
this . #tick( ) ;
595
- return Promise . all ( [
595
+ const [ reply ] = await Promise . all ( [
596
596
quitPromise ,
597
597
this . #destroyIsolationPool( )
598
598
] ) ;
599
+ return reply ;
599
600
} ) ;
600
601
}
601
602
Original file line number Diff line number Diff line change @@ -240,14 +240,15 @@ export default class RedisSocket extends EventEmitter {
240
240
this . emit ( 'end' ) ;
241
241
}
242
242
243
- async quit ( fn : ( ) => Promise < unknown > ) : Promise < void > {
243
+ async quit < T > ( fn : ( ) => Promise < T > ) : Promise < T > {
244
244
if ( ! this . #isOpen) {
245
245
throw new ClientClosedError ( ) ;
246
246
}
247
247
248
248
this . #isOpen = false ;
249
- await fn ( ) ;
249
+ const reply = await fn ( ) ;
250
250
this . #disconnect( ) ;
251
+ return reply ;
251
252
}
252
253
253
254
#isCorked = false ;
You can’t perform that action at this time.
0 commit comments