YUKI Hiroshi
null+****@clear*****
Wed Apr 29 15:39:09 JST 2015
YUKI Hiroshi 2015-04-29 15:39:09 +0900 (Wed, 29 Apr 2015) New Revision: ee8c0a0aa0ab19336e755d699f5b438f7682b288 https://github.com/droonga/express-droonga/commit/ee8c0a0aa0ab19336e755d699f5b438f7682b288 Message: Handle errors and output more trace logs for debugging Modified files: lib/droonga-protocol/connection-pool.js Modified: lib/droonga-protocol/connection-pool.js (+18 -3) =================================================================== --- lib/droonga-protocol/connection-pool.js 2015-04-29 15:09:20 +0900 (89fa5a4) +++ lib/droonga-protocol/connection-pool.js 2015-04-29 15:39:09 +0900 (e2400f9) @@ -251,25 +251,35 @@ ConnectionPool.prototype = { this._watching = true; this._serf.on('member-change', (function() { this._logger.info(LOG_PREFIX + 'Serf cluster member is changed.'); - if (this._updateHostNamesTimer) + if (this._updateHostNamesTimer) { + this._logger.trace(LOG_PREFIX + 'Task to update host names is already running.'); return; + } this._updateHostNamesTimer = setTimeout((function() { this._updateHostNamesTimer = null; + this._logger.trace(LOG_PREFIX + 'Starting to update host names...'); this.updateHostNamesFromCluster() .then((function() { if (this._hostNames.length == 0) { + this._logger.info(LOG_PREFIX + 'No service provider in the cluster. ' + + 'Trying to join to the initial cluster...'); return this.reJoinToInitialCluster(); } + }).bind(this)) + .catch((function(error) { + this._logger.error(LOG_PREFIX + 'Failed to update host names.', + error); + reject(error); }).bind(this)); }).bind(this), 500); }).bind(this)); resolve(); }).bind(this)) - .catch(function(error) { + .catch((function(error) { this._logger.error(LOG_PREFIX + 'Failed to start watching of changes in the cluster.', error); reject(error); - }); + }).bind(this)); }).bind(this)); }, @@ -282,6 +292,11 @@ ConnectionPool.prototype = { delete this._serf; this._watching = false; resolve(); + }).bind(this)) + .catch((function(error) { + this._logger.error(LOG_PREFIX + 'Failed to stop watching.', + error); + reject(error); }).bind(this)); }).bind(this)); }, -------------- next part -------------- HTML����������������������������... 다운로드