YUKI Hiroshi
null+****@clear*****
Fri Oct 17 16:39:51 JST 2014
YUKI Hiroshi 2014-10-17 16:39:51 +0900 (Fri, 17 Oct 2014) New Revision: 9e2172f6147126ef817dca24abe96503af69b87b https://github.com/droonga/express-droonga/commit/9e2172f6147126ef817dca24abe96503af69b87b Message: Don't instantiate multiple connections for a host Modified files: lib/droonga-protocol/connections.js Modified: lib/droonga-protocol/connections.js (+11 -0) =================================================================== --- lib/droonga-protocol/connections.js 2014-10-17 16:36:55 +0900 (b2ce82c) +++ lib/droonga-protocol/connections.js 2014-10-17 16:39:51 +0900 (7369fa9) @@ -22,6 +22,17 @@ function Connections(params) { if (!Array.isArray(hostNames)) this._params.hostNames = [hostNames]; + var uniqueHostNames = {}; + this._params.hostNames = this._params.hostNames.filter(function(hostName) { + if (hostName in uniqueHostNames) { + return false; + } + else { + uniqueHostNames[hostName] = true; + return true; + } + }); + if (this._params.hostNames.length == 0) throw new Error('Connections: you must give one or more host name(s)!'); -------------- next part -------------- HTML����������������������������...다운로드