[Groonga-commit] droonga/express-droonga at e521975 [master] Ignore error while processing callback functions when the connection is closing

Zurück zum Archiv-Index

YUKI Hiroshi null+****@clear*****
Wed Apr 8 20:29:42 JST 2015


YUKI Hiroshi	2015-04-08 20:29:42 +0900 (Wed, 08 Apr 2015)

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

  Message:
    Ignore error while processing callback functions when the connection is closing

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

  Modified: lib/droonga-protocol/connection.js (+8 -2)
===================================================================
--- lib/droonga-protocol/connection.js    2015-04-08 20:28:42 +0900 (0f7fdf6)
+++ lib/droonga-protocol/connection.js    2015-04-08 20:29:42 +0900 (0bad7b1)
@@ -283,8 +283,14 @@ Connection.prototype.close = function() {
   Object.keys(this._sendingMessages).forEach(function(id) {
     var message = this._sendingMessages[id];
     var callback = message.callback;
-    if (typeof callback == 'function')
-      callback(ERROR_SERVICE_UNAVAILABLE, null);
+    if (typeof callback == 'function') {
+      try {
+        callback(ERROR_SERVICE_UNAVAILABLE, null);
+      }
+      catch(error) {
+        this._logger.error(error)
+      }
+    }
   }, this);
   this._sendingMessages = {};
 
-------------- next part --------------
HTML����������������������������...
Download 



More information about the Groonga-commit mailing list
Zurück zum Archiv-Index