[Groonga-commit] droonga/express-droonga at cc9ded1 [master] Output more logs on the shutdown process

Back to archive index

YUKI Hiroshi null+****@clear*****
Tue Apr 7 17:28:37 JST 2015


YUKI Hiroshi	2015-04-07 17:28:37 +0900 (Tue, 07 Apr 2015)

  New Revision: cc9ded13e5ba13b4e5e4a1323517564fbcfcf3f4
  https://github.com/droonga/express-droonga/commit/cc9ded13e5ba13b4e5e4a1323517564fbcfcf3f4

  Message:
    Output more logs on the shutdown process

  Modified files:
    index.js
    lib/droonga-protocol/connection-pool.js

  Modified: index.js (+5 -8)
===================================================================
--- index.js    2015-04-07 16:36:24 +0900 (8673c00)
+++ index.js    2015-04-07 17:28:37 +0900 (2ae7c59)
@@ -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();
     });
   }
 

  Modified: lib/droonga-protocol/connection-pool.js (+10 -0)
===================================================================
--- lib/droonga-protocol/connection-pool.js    2015-04-07 16:36:24 +0900 (2d7d036)
+++ lib/droonga-protocol/connection-pool.js    2015-04-07 17:28:37 +0900 (6215b34)
@@ -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.');
   }
 };
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Back to archive index