File tree Expand file tree Collapse file tree 2 files changed +10
-13
lines changed Expand file tree Collapse file tree 2 files changed +10
-13
lines changed Original file line number Diff line number Diff line change @@ -90,7 +90,8 @@ function RedisClient(options) {
90
90
this . old_state = null ;
91
91
this . pipeline = 0 ;
92
92
this . options = options ;
93
-
93
+ // Init parser once per instance
94
+ this . init_parser ( ) ;
94
95
self . stream = net . createConnection ( cnx_options ) ;
95
96
self . install_stream_listeners ( ) ;
96
97
}
@@ -256,8 +257,6 @@ RedisClient.prototype.on_connect = function () {
256
257
this . stream . setKeepAlive ( this . options . socket_keepalive ) ;
257
258
this . stream . setTimeout ( 0 ) ;
258
259
259
- this . init_parser ( ) ;
260
-
261
260
if ( typeof this . auth_pass === 'string' ) {
262
261
this . do_auth ( ) ;
263
262
} else {
Original file line number Diff line number Diff line change @@ -10,17 +10,15 @@ describe("The node_redis client", function () {
10
10
11
11
describe ( "testing parser existence" , function ( ) {
12
12
it ( 'throws on non-existence' , function ( done ) {
13
- var mochaListener = helper . removeMochaListener ( ) ;
14
-
15
- process . once ( 'uncaughtException' , function ( err ) {
16
- process . on ( 'uncaughtException' , mochaListener ) ;
13
+ try {
14
+ redis . createClient ( {
15
+ parser : 'nonExistingParser'
16
+ } ) ;
17
+ done ( new Error ( 'test failed' ) ) ;
18
+ } catch ( err ) {
17
19
assert . equal ( err . message , 'Couldn\'t find named parser nonExistingParser on this system' ) ;
18
- return done ( ) ;
19
- } ) ;
20
-
21
- redis . createClient ( {
22
- parser : 'nonExistingParser'
23
- } ) ;
20
+ done ( ) ;
21
+ }
24
22
} ) ;
25
23
} ) ;
26
24
You can’t perform that action at this time.
0 commit comments