[Groonga-commit] groonga/express-kotoumi [master] Close backend connections if the frontend server is dead

Back to archive index

YUKI Hiroshi null+****@clear*****
Mon Feb 4 16:58:46 JST 2013


YUKI Hiroshi	2013-02-04 16:58:46 +0900 (Mon, 04 Feb 2013)

  New Revision: 28f5f5d5b4a78ef43022cddb31f4c5efdeeb0ec8
  https://github.com/groonga/express-kotoumi/commit/28f5f5d5b4a78ef43022cddb31f4c5efdeeb0ec8

  Log:
    Close backend connections if the frontend server is dead

  Modified files:
    index.js

  Modified: index.js (+6 -3)
===================================================================
--- index.js    2013-02-04 12:36:42 +0900 (cc1934b)
+++ index.js    2013-02-04 16:58:46 +0900 (dcbfaf4)
@@ -8,19 +8,22 @@ express.application.kotoumi = function(params) {
   params = params || {};
 
   params.connection = params.connection || new Connection(params);
+  var connection = params.connection;
 
   params.prefix = params.prefix || '';
   params.prefix = params.prefix.replace(/\/$/, '');
 
   restHandler.register(this, params);
 
-  if (params.server)
+  if (params.server) {
     socketIoHandler.register(this, params.server, params);
+    params.server.on('close', function() {
+      connection.close();
+    });
+  }
 
   dashboardHandler.register(this, params);
 
-  var connection = params.connection;
-
   this.connection = connection;
   this.emitMessage = connection.emitMessage.bind(connection); // shorthand
 }
-------------- next part --------------
HTML����������������������������...
Download 



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