File tree Expand file tree Collapse file tree 2 files changed +34
-2
lines changed
packages/client/lib/client Expand file tree Collapse file tree 2 files changed +34
-2
lines changed Original file line number Diff line number Diff line change @@ -8,4 +8,35 @@ describe('RedisClientPool', () => {
8
8
'PONG'
9
9
) ;
10
10
} , GLOBAL . SERVERS . OPEN ) ;
11
+
12
+ testUtils . testWithClientPool (
13
+ 'proper error propagation in sequential operations' ,
14
+ async ( pool ) => {
15
+ let hasUnhandledRejection = false ;
16
+
17
+ process . once ( 'unhandledRejection' , ( ) => {
18
+ hasUnhandledRejection = true ;
19
+ } ) ;
20
+
21
+ const groupName = 'test-group' ;
22
+ const streamName = 'test-stream' ;
23
+
24
+ // First attempt - should succeed
25
+ await pool . xGroupCreate ( streamName , groupName , '0' , {
26
+ MKSTREAM : true ,
27
+ } ) ;
28
+
29
+ // Subsequent attempts - should all throw BUSYGROUP errors and be handled properly
30
+ for ( let i = 0 ; i < 3 ; i ++ ) {
31
+ await assert . rejects (
32
+ pool . xGroupCreate ( streamName , groupName , '0' , {
33
+ MKSTREAM : true ,
34
+ } )
35
+ ) ;
36
+ }
37
+
38
+ assert . equal ( hasUnhandledRejection , false ) ;
39
+ } ,
40
+ GLOBAL . SERVERS . OPEN
41
+ ) ;
11
42
} ) ;
Original file line number Diff line number Diff line change @@ -438,8 +438,9 @@ export class RedisClientPool<
438
438
) {
439
439
const result = fn ( node . value ) ;
440
440
if ( result instanceof Promise ) {
441
- result . then ( resolve , reject ) ;
442
- result . finally ( ( ) => this . #returnClient( node ) )
441
+ result
442
+ . then ( resolve , reject )
443
+ . finally ( ( ) => this . #returnClient( node ) )
443
444
} else {
444
445
resolve ( result ) ;
445
446
this . #returnClient( node ) ;
You can’t perform that action at this time.
0 commit comments