File tree Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Expand file tree Collapse file tree 1 file changed +21
-2
lines changed Original file line number Diff line number Diff line change @@ -192,9 +192,28 @@ export default class ClusterSubscriber {
192192 let pending = 0 ;
193193 for ( const type of [ "subscribe" , "psubscribe" , "ssubscribe" ] ) {
194194 const channels = previousChannels [ type ] ;
195- if ( channels . length ) {
195+ if ( channels . length == 0 ) {
196+ continue ;
197+ }
198+
199+ debug ( "%s %d channels" , type , channels . length ) ;
200+
201+ if ( type === "ssubscribe" ) {
202+ for ( const channel of channels ) {
203+ pending += 1 ;
204+ this . subscriber [ type ] ( channel )
205+ . then ( ( ) => {
206+ if ( ! -- pending ) {
207+ this . lastActiveSubscriber = this . subscriber ;
208+ }
209+ } )
210+ . catch ( ( ) => {
211+ // TODO: should probably disconnect the subscriber and try again.
212+ debug ( "failed to ssubscribe to channel: %s" , channel ) ;
213+ } ) ;
214+ }
215+ } else {
196216 pending += 1 ;
197- debug ( "%s %d channels" , type , channels . length ) ;
198217 this . subscriber [ type ] ( channels )
199218 . then ( ( ) => {
200219 if ( ! -- pending ) {
You can’t perform that action at this time.
0 commit comments