File tree Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Expand file tree Collapse file tree 1 file changed +5
-2
lines changed Original file line number Diff line number Diff line change @@ -199,6 +199,9 @@ RedisClient.prototype.on_error = function (msg) {
199
199
this . connection_gone ( "error" ) ;
200
200
} ;
201
201
202
+ var noPasswordIsSet = / n o p a s s w o r d i s s e t / ;
203
+ var loading = / L O A D I N G / ;
204
+
202
205
RedisClient . prototype . do_auth = function ( ) {
203
206
var self = this ;
204
207
@@ -207,14 +210,14 @@ RedisClient.prototype.do_auth = function () {
207
210
self . send_anyway = true ;
208
211
self . send_command ( "auth" , [ this . auth_pass ] , function ( err , res ) {
209
212
if ( err ) {
210
- if ( err . toString ( ) . match ( "LOADING" ) ) {
213
+ if ( loading . test ( err . message ) ) {
211
214
// if redis is still loading the db, it will not authenticate and everything else will fail
212
215
console . log ( "Redis still loading, trying to authenticate later" ) ;
213
216
setTimeout ( function ( ) {
214
217
self . do_auth ( ) ;
215
218
} , 2000 ) ; // TODO - magic number alert
216
219
return ;
217
- } else if ( err . toString ( ) . match ( "no password is set" ) ) {
220
+ } else if ( noPasswordIsSet . test ( err . message ) ) {
218
221
console . log ( "Warning: Redis server does not require a password, but a password was supplied." ) ;
219
222
err = null ;
220
223
res = "OK" ;
You can’t perform that action at this time.
0 commit comments