YUKI Hiroshi
null+****@clear*****
Wed Nov 5 17:08:38 JST 2014
YUKI Hiroshi 2014-11-05 17:08:38 +0900 (Wed, 05 Nov 2014) New Revision: c9b9b77060aabfa5c8656b525a9fb87a42f09083 https://github.com/droonga/express-droonga/commit/c9b9b77060aabfa5c8656b525a9fb87a42f09083 Message: Throttle to update host names from member-change events Modified files: lib/droonga-protocol/connection-pool.js Modified: lib/droonga-protocol/connection-pool.js (+8 -1) =================================================================== --- lib/droonga-protocol/connection-pool.js 2014-11-05 16:57:20 +0900 (a04db4d) +++ lib/droonga-protocol/connection-pool.js 2014-11-05 17:08:38 +0900 (106a3ad) @@ -196,7 +196,14 @@ ConnectionPool.prototype = { this._logger.error('Failed to start watching of changes in the cluster.'); this._logger.error(error); }); - this._serf.on('member-change', this.updateHostNamesFromCluster.bind(this)); + this._serf.on('member-change', (function() { + if (this._updateHostNamesTimer) + return; + this._updateHostNamesTimer = setTimeout((function() { + this._updateHostNamesTimer = null; + this.updateHostNamesFromCluster(); + }).bind(this), 500); + }).bind(this)); this._watching = true; }, -------------- next part -------------- HTML����������������������������... ダウンロード