File tree Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Expand file tree Collapse file tree 1 file changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -196,6 +196,7 @@ MongoStore.prototype.initialise = function(resourceConfig) {
196196 } ) . then ( function ( db ) {
197197 self . _db = db ;
198198 //Set a keep alive timer.
199+ console . log ( 'Successfully connected to mongo.' ) ;
199200 timers . setTimeout ( self . keepAlive . bind ( self ) , KEEP_ALIVE_TIMER_MS ) ;
200201 self . _db . on ( "timeout" , function ( ) {
201202 console . error ( "mongodb connection timeout." ) ;
@@ -207,13 +208,16 @@ MongoStore.prototype.initialise = function(resourceConfig) {
207208 self . ready = false ;
208209 self . initialise ( resourceConfig ) ;
209210 } ) ;
210- } ) . catch ( function ( err ) {
211- console . error ( "mongodb connection failed:" , err . message ) ;
212211 } ) . then ( function ( ) {
213212 var resourceName = resourceConfig . resource ;
214213 var collection = self . _db . collection ( resourceName ) ;
215214 self . _createIndexesForRelationships ( collection , self . relationshipAttributeNames ) ;
216215 self . ready = true ;
216+ } ) . catch ( function ( err ) {
217+ console . error ( "mongodb connection failed:" , err . message ) ;
218+ setTimeout ( function ( ) {
219+ process . kill ( process . pid , 'SIGTERM' ) ;
220+ } , 5000 ) ;
217221 } ) ;
218222} ;
219223
You can’t perform that action at this time.
0 commit comments