File tree Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Expand file tree Collapse file tree 2 files changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -308,7 +308,8 @@ RedisClient.prototype.on_ready = function () {
308308 }
309309 } ;
310310 Object . keys ( this . subscription_set ) . forEach ( function ( key ) {
311- var parts = key . split ( " " ) ;
311+ var space_index = key . indexOf ( " " ) ;
312+ var parts = [ key . slice ( 0 , space_index ) , key . slice ( space_index + 1 ) ] ;
312313 debug ( "Sending pub/sub on_ready " + parts [ 0 ] + ", " + parts [ 1 ] ) ;
313314 callback_count ++ ;
314315 self . send_command ( parts [ 0 ] + "scribe" , [ parts [ 1 ] ] , callback ) ;
Original file line number Diff line number Diff line change @@ -43,14 +43,22 @@ describe("publish/subscribe", function () {
4343 } ) ;
4444
4545 describe ( 'subscribe' , function ( ) {
46- it ( 'fires a subscribe event for each channel subscribed to' , function ( done ) {
46+ it ( 'fires a subscribe event for each channel subscribed to even after reconnecting' , function ( done ) {
47+ var a = false ;
4748 sub . on ( "subscribe" , function ( chnl , count ) {
4849 if ( chnl === channel2 ) {
4950 assert . equal ( 2 , count ) ;
50- return done ( ) ;
51+ if ( a ) {
52+ return done ( ) ;
53+ }
54+ sub . stream . destroy ( ) ;
5155 }
5256 } ) ;
5357
58+ sub . on ( 'reconnecting' , function ( ) {
59+ a = true ;
60+ } ) ;
61+
5462 sub . subscribe ( channel , channel2 ) ;
5563 } ) ;
5664
You can’t perform that action at this time.
0 commit comments