Navigation Menu

Skip to content

Commit

Permalink
Output more logs on the shutdown process
Browse files Browse the repository at this point in the history
  • Loading branch information
piroor committed Apr 7, 2015
1 parent a5eec0f commit cc9ded1
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 8 deletions.
13 changes: 5 additions & 8 deletions index.js
Expand Up @@ -21,16 +21,13 @@ function droonga(application, params) {
if (params.server) {
socketIoAdapter.register(application, params.server, params);
params.server.on('error', function(error) {
if (typeof connectionPool.closeAll == 'function')
connectionPool.closeAll();
if (typeof connectionPool.stopSyncHostNamesFromCluster == 'function')
connectionPool.stopSyncHostNamesFromCluster();
params.logger.error(error);
if (typeof connectionPool.shutdown == 'function')
connectionPool.shutdown();
});
params.server.on('close', function() {
if (typeof connectionPool.closeAll == 'function')
connectionPool.closeAll();
if (typeof connectionPool.stopSyncHostNamesFromCluster == 'function')
connectionPool.stopSyncHostNamesFromCluster();
if (typeof connectionPool.shutdown == 'function')
connectionPool.shutdown();
});
}

Expand Down
10 changes: 10 additions & 0 deletions lib/droonga-protocol/connection-pool.js
Expand Up @@ -277,6 +277,16 @@ ConnectionPool.prototype = {

stopSyncHostNamesFromCluster: function() {
return this.endWatchClusterChanges();
},

shutdown: function() {
this._logger.info('closing all connections...');
this.closeAll();
this._logger.info('done.');

this._logger.info('stopping serf agent...');
this.stopSyncHostNamesFromCluster();
this._logger.info('done.');
}
};

Expand Down

0 comments on commit cc9ded1

Please sign in to comment.