@@ -235,6 +235,18 @@ describe('Cluster', () => {
235
235
236
236
assert . equal ( cluster . pubSubNode , undefined ) ;
237
237
} , GLOBAL . CLUSTERS . OPEN ) ;
238
+
239
+ testUtils . testWithCluster ( 'concurrent UNSUBSCRIBE does not throw an error (#2685)' , async cluster => {
240
+ const listener = spy ( ) ;
241
+ await Promise . all ( [
242
+ cluster . subscribe ( '1' , listener ) ,
243
+ cluster . subscribe ( '2' , listener )
244
+ ] ) ;
245
+ await Promise . all ( [
246
+ cluster . unsubscribe ( '1' , listener ) ,
247
+ cluster . unsubscribe ( '2' , listener )
248
+ ] ) ;
249
+ } , GLOBAL . CLUSTERS . OPEN ) ;
238
250
239
251
testUtils . testWithCluster ( 'psubscribe & punsubscribe' , async cluster => {
240
252
const listener = spy ( ) ;
@@ -323,6 +335,21 @@ describe('Cluster', () => {
323
335
minimumDockerVersion : [ 7 ]
324
336
} ) ;
325
337
338
+ testUtils . testWithCluster ( 'concurrent SUNSUBCRIBE does not throw an error (#2685)' , async cluster => {
339
+ const listener = spy ( ) ;
340
+ await Promise . all ( [
341
+ await cluster . sSubscribe ( '1' , listener ) ,
342
+ await cluster . sSubscribe ( '2' , listener )
343
+ ] ) ;
344
+ await Promise . all ( [
345
+ cluster . sUnsubscribe ( '1' , listener ) ,
346
+ cluster . sUnsubscribe ( '2' , listener )
347
+ ] ) ;
348
+ } , {
349
+ ...GLOBAL . CLUSTERS . OPEN ,
350
+ minimumDockerVersion : [ 7 ]
351
+ } ) ;
352
+
326
353
testUtils . testWithCluster ( 'should handle sharded-channel-moved events' , async cluster => {
327
354
const SLOT = 10328 ,
328
355
migrating = cluster . slots [ SLOT ] . master ,
0 commit comments