@@ -4,6 +4,7 @@ var utils = require('./utils');
44var debug = require ( './debug' ) ;
55var Multi = require ( './multi' ) ;
66var no_password_is_set = / n o p a s s w o r d i s s e t / ;
7+ var loading = / L O A D I N G / ;
78var RedisClient = require ( '../' ) . RedisClient ;
89
910/********************************
@@ -36,14 +37,14 @@ RedisClient.prototype.select = RedisClient.prototype.SELECT = function select (d
3637RedisClient . prototype . info = RedisClient . prototype . INFO = function info ( section , callback ) {
3738 var self = this ;
3839 var ready = this . ready ;
40+ var args = [ ] ;
3941 if ( typeof section === 'function' ) {
4042 callback = section ;
41- section = 'default' ;
42- } else if ( section === undefined ) {
43- section = 'default' ;
43+ } else if ( section !== undefined ) {
44+ args = Array . isArray ( section ) ? section : [ section ] ;
4445 }
4546 this . ready = ready || this . offline_queue . length === 0 ; // keep the execution order intakt
46- var tmp = this . send_command ( 'info' , [ section ] , function ( err , res ) {
47+ var tmp = this . send_command ( 'info' , args , function ( err , res ) {
4748 if ( res ) {
4849 var obj = { } ;
4950 var lines = res . toString ( ) . split ( '\r\n' ) ;
@@ -91,12 +92,20 @@ RedisClient.prototype.auth = RedisClient.prototype.AUTH = function auth (pass, c
9192 this . auth_pass = pass ;
9293 this . ready = this . offline_queue . length === 0 ; // keep the execution order intakt
9394 var tmp = this . send_command ( 'auth' , [ pass ] , function ( err , res ) {
94- if ( err && no_password_is_set . test ( err . message ) ) {
95- self . warn ( 'Warning: Redis server does not require a password, but a password was supplied.' ) ;
96- err = null ;
97- res = 'OK' ;
95+ if ( err ) {
96+ if ( no_password_is_set . test ( err . message ) ) {
97+ self . warn ( 'Warning: Redis server does not require a password, but a password was supplied.' ) ;
98+ err = null ;
99+ res = 'OK' ;
100+ } else if ( loading . test ( err . message ) ) {
101+ // If redis is still loading the db, it will not authenticate and everything else will fail
102+ debug ( 'Redis still loading, trying to authenticate later' ) ;
103+ setTimeout ( function ( ) {
104+ self . auth ( pass , callback ) ;
105+ } , 200 ) ;
106+ return ;
107+ }
98108 }
99-
100109 utils . callback_or_emit ( self , callback , err , res ) ;
101110 } ) ;
102111 this . ready = ready ;
0 commit comments