@@ -387,7 +387,6 @@ export class Subscriber extends ISubscriber {
387
387
if ( ! subscriptions . length ) return ;
388
388
subscriptions . forEach ( ( subscription ) => {
389
389
this . setSubscription ( subscription . id , { ...subscription } ) ;
390
- this . pending . delete ( subscription . topic ) ;
391
390
} ) ;
392
391
}
393
392
@@ -467,7 +466,12 @@ export class Subscriber extends ISubscriber {
467
466
for ( let i = 0 ; i < numOfBatches ; i ++ ) {
468
467
const batch = subs . splice ( 0 , this . batchSubscribeTopicsLimit ) ;
469
468
// await this.batchFetchMessages(batch);
470
- await this . batchSubscribe ( batch ) ;
469
+ await new Promise < void > ( ( resolve ) => {
470
+ setTimeout ( async ( ) => {
471
+ await this . batchSubscribe ( batch ) ;
472
+ resolve ( ) ;
473
+ } , 1000 ) ;
474
+ } ) ;
471
475
}
472
476
}
473
477
this . events . emit ( SUBSCRIBER_EVENTS . resubscribed ) ;
@@ -495,13 +499,13 @@ export class Subscriber extends ISubscriber {
495
499
496
500
private async batchSubscribe ( subscriptions : SubscriberTypes . Params [ ] ) {
497
501
if ( ! subscriptions . length ) return ;
498
-
499
502
this . onBatchSubscribe (
500
503
subscriptions . map ( ( s ) => ( { ...s , id : this . getSubscriptionId ( s . topic ) } ) ) ,
501
504
) ;
502
- setTimeout ( async ( ) => {
503
- await this . rpcBatchSubscribe ( subscriptions ) ;
504
- } , 1000 ) ;
505
+ await this . rpcBatchSubscribe ( subscriptions ) ;
506
+ subscriptions . forEach ( ( s ) => {
507
+ this . pending . delete ( s . topic ) ;
508
+ } ) ;
505
509
}
506
510
507
511
// @ts -ignore
0 commit comments