File tree 2 files changed +16
-1
lines changed
2 files changed +16
-1
lines changed Original file line number Diff line number Diff line change @@ -276,6 +276,12 @@ Redis.prototype.connect = function (callback) {
276
276
stream . setTimeout ( _this . options . connectTimeout , function ( ) {
277
277
stream . setTimeout ( 0 ) ;
278
278
stream . destroy ( ) ;
279
+
280
+ var err = new Error ( 'connect ETIMEDOUT' ) ;
281
+ err . errorno = 'ETIMEDOUT' ;
282
+ err . code = 'ETIMEDOUT' ;
283
+ err . syscall = 'connect' ;
284
+ eventHandler . errorHandler ( _this ) ( err ) ;
279
285
} ) ;
280
286
stream . once ( CONNECT_EVENT , function ( ) {
281
287
stream . setTimeout ( 0 ) ;
Original file line number Diff line number Diff line change @@ -48,9 +48,18 @@ describe('connection', function () {
48
48
connectTimeout : 1 ,
49
49
retryStrategy : null
50
50
} ) ;
51
+ var pending = 2 ;
52
+ redis . on ( 'error' , function ( err ) {
53
+ expect ( err . message ) . to . eql ( 'connect ETIMEDOUT' ) ;
54
+ if ( ! -- pending ) {
55
+ done ( ) ;
56
+ }
57
+ } ) ;
51
58
redis . get ( 'foo' , function ( err ) {
52
59
expect ( err . message ) . to . match ( / C o n n e c t i o n i s c l o s e d / ) ;
53
- done ( ) ;
60
+ if ( ! -- pending ) {
61
+ done ( ) ;
62
+ }
54
63
} ) ;
55
64
} ) ;
56
65
You can’t perform that action at this time.
0 commit comments