File tree Expand file tree Collapse file tree 3 files changed +13
-3
lines changed
Expand file tree Collapse file tree 3 files changed +13
-3
lines changed Original file line number Diff line number Diff line change 99Bugfixes
1010
1111- Fixed not always copying subscribe unsubscribe arguments
12+ - Fixed emitting internal errors while reconnecting with auth
1213
1314## v.2.7.1 - 14 Mar, 2017
1415
Original file line number Diff line number Diff line change @@ -228,6 +228,8 @@ function create_parser (self) {
228228RedisClient . prototype . create_stream = function ( ) {
229229 var self = this ;
230230
231+ var first_attempt = ! this . stream ;
232+
231233 // Init parser
232234 this . reply_parser = create_parser ( this ) ;
233235
@@ -304,7 +306,13 @@ RedisClient.prototype.create_stream = function () {
304306 // Fire the command before redis is connected to be sure it's the first fired command
305307 if ( this . auth_pass !== undefined ) {
306308 this . ready = true ;
307- this . auth ( this . auth_pass ) ;
309+ // Fail silently as we might not be able to connect
310+ this . auth ( this . auth_pass , function ( err ) {
311+ if ( err && first_attempt ) {
312+ self . command_queue . get ( 0 ) . callback = noop ;
313+ self . emit ( 'error' , err ) ;
314+ }
315+ } ) ;
308316 this . ready = false ;
309317 }
310318} ;
Original file line number Diff line number Diff line change @@ -260,9 +260,10 @@ describe('client authentication', function () {
260260 password : 'wrong_password' ,
261261 parser : parser
262262 } ) ;
263- client . once ( 'error' , function ( err ) {
263+ client . on ( 'error' , function ( err ) {
264264 assert . strictEqual ( err . message , 'ERR invalid password' ) ;
265- done ( ) ;
265+ // Make sure no other errors are reported
266+ setTimeout ( done , 50 ) ;
266267 } ) ;
267268 } ) ;
268269
You can’t perform that action at this time.
0 commit comments