YUKI Hiroshi
null+****@clear*****
Wed Jan 30 11:49:35 JST 2013
YUKI Hiroshi 2013-01-30 11:49:35 +0900 (Wed, 30 Jan 2013) New Revision: a164aec22d9585775e80812c83efe7030db2c986 https://github.com/groonga/express-kotoumi/commit/a164aec22d9585775e80812c83efe7030db2c986 Log: Remove codes about extended fluent-logger Removed files: lib/backend/fluent-logger.js Modified files: lib/backend/connection.js Modified: lib/backend/connection.js (+2 -11) =================================================================== --- lib/backend/connection.js 2013-01-29 18:34:15 +0900 (976c7a5) +++ lib/backend/connection.js 2013-01-30 11:49:35 +0900 (c1b8424) @@ -7,7 +7,6 @@ */ var EventEmitter = require('events').EventEmitter; -var extendedFluent = require('./fluent-logger'); var fluent = require('fluent-logger'); var Receiver = require('./receiver').Receiver; @@ -20,12 +19,6 @@ var DEFAULT_FLUENT_HOST_NAME = var DEFAULT_FLUENT_PORT = Connection.DEFAULT_FLUENT_PORT = 24224; -var DEFAULT_FLUENT_MAX_RETRY_COUNT = - Connection.DEFAULT_FLUENT_MAX_RETRY_COUNT = - 3; -var DEFAULT_FLUENT_RETRY_DELAY = - Connection.DEFAULT_FLUENT_RETRY_DELAY = - 1000; var DEFAULT_RECEIVE_HOST_NAME = Connection.DEFAULT_RECEIVE_HOST_NAME = 'localhost'; @@ -48,10 +41,8 @@ Connection.prototype._init = function() { }; Connection.prototype._initSender = function(wait) { - var options = { host: this._params.hostName || DEFAULT_FLUENT_HOST_NAME, - port: this._params.port || DEFAULT_FLUENT_PORT, - maxRetryCount: this._params.maxRetryCount || DEFAULT_FLUENT_MAX_RETRY_COUNT, - retryDelay: this._params.retryDelay || DEFAULT_FLUENT_RETRY_DELAY }; + var options = { host: this._params.hostName || DEFAULT_FLUENT_HOST_NAME, + port: this._params.port || DEFAULT_FLUENT_PORT }; var sender = fluent.createFluentSender(this._params.tag || DEFAULT_FLUENT_TAG, options); this._sender = sender; Deleted: lib/backend/fluent-logger.js (+0 -67) 100644 =================================================================== --- lib/backend/fluent-logger.js 2013-01-29 18:34:15 +0900 (a3fe2e0) +++ /dev/null @@ -1,67 +0,0 @@ -/** - * fluent-logger-node mod - * "reconnect" option - */ - -var net = require('net'); -var sender = require('fluent-logger/lib/sender'); - -var OriginalFluentSender = sender.FluentSender; - -function ExtendedFluentSender(tag, options) { - options = options || {}; - var sender = new OriginalFluentSender(tag, options); - sender.maxRetryCount = options.maxRetryCount || 0; - sender.retryDelay = options.retryDelay || 1000; - return sender; -} - -OriginalFluentSender.prototype.emit = function(label, data, callback, retryCount){ - var self = this; - var item = self._makePacketItem(label, data); - item.callback = callback; - self._sendQueue.push(item); - self._sendQueueTail++; - self._connect( - function() { - self._flushSendQueue(); - }, - function() { - retryCount = retryCount || 0; - if (self.maxRetryCount && retryCount < self.maxRetryCount) { - setTimeout(function() { - self.emit(label, data, callback, retryCount + 1); - }, self.retryDelay); - return true; - } else { - return false; - } - } - ); -}; - -OriginalFluentSender.prototype._connect = function(successCallback, retryCallback) { - var self = this; - if (self._socket === null) { - self._socket = new net.Socket(); - self._socket.setTimeout(self.timeout); - self._socket.on('error', function(err) { - if (self._socket) { - self._socket.destroy(); - self._socket = null; - if (!retryCallback || !retryCallback()) { - self._eventEmitter.emit('error', err); - } - } - }); - self._socket.connect(self.port, self.host, function() { - successCallback(); - }); - } else { - process.nextTick(function() { - successCallback(); - }); - } -}; - -sender.FluentSender = ExtendedFluentSender; -------------- next part -------------- HTML����������������������������... Descargar