@@ -121,28 +121,28 @@ ESConnector.prototype.connect = function (callback) {
121
121
} else {
122
122
self . db = new elasticsearch . Client ( self . getClientConfig ( ) ) ;
123
123
self . db . ping ( {
124
- requestTimeout : 10000
124
+ requestTimeout : self . settings . requestTimeout
125
125
} , function ( error ) {
126
126
if ( error ) {
127
- throw callback ( error ) ;
128
- } else {
129
- if ( self . settings . mappingProperties ) {
130
- self . setupMappings ( )
131
- . then ( function ( ) {
132
- log ( 'ESConnector.prototype.connect' , 'setupMappings' , 'finished' ) ;
133
- callback && callback ( null , self . db ) ;
134
- } )
135
- . catch ( function ( err ) {
136
- log ( 'ESConnector.prototype.connect' , 'setupMappings' , 'failed' , err ) ;
137
- callback && callback ( null , self . db ) ;
138
- } ) ;
139
- } else {
140
- process . nextTick ( function ( ) {
141
- callback && callback ( null , self . db ) ;
142
- } ) ;
143
- }
127
+ console . log ( 'ESConnector.prototype.connect' , 'ping' , 'failed' , error ) ;
128
+ log ( 'ESConnector.prototype.connect' , 'ping' , 'failed' , error ) ;
144
129
}
145
130
} ) ;
131
+ if ( self . settings . mappingProperties ) {
132
+ self . setupMappings ( )
133
+ . then ( function ( ) {
134
+ log ( 'ESConnector.prototype.connect' , 'setupMappings' , 'finished' ) ;
135
+ callback && callback ( null , self . db ) ;
136
+ } )
137
+ . catch ( function ( err ) {
138
+ log ( 'ESConnector.prototype.connect' , 'setupMappings' , 'failed' , err ) ;
139
+ callback && callback ( null , self . db ) ;
140
+ } ) ;
141
+ } else {
142
+ process . nextTick ( function ( ) {
143
+ callback && callback ( null , self . db ) ;
144
+ } ) ;
145
+ }
146
146
}
147
147
} ;
148
148
@@ -218,8 +218,9 @@ ESConnector.prototype.setupIndex = require('./setupIndex.js')({
218
218
* @returns {String } with ping result
219
219
*/
220
220
ESConnector . prototype . ping = function ( cb ) {
221
- this . db . ping ( {
222
- requestTimeout : 1000
221
+ var self = this ;
222
+ self . db . ping ( {
223
+ requestTimeout : self . settings . requestTimeout
223
224
} , function ( error ) {
224
225
if ( error ) {
225
226
log ( 'Could not ping ES.' ) ;
0 commit comments