Class: FacebookService::QueuedLogMessageHandler
- Inherits:
-
BaseHandler
- Object
- BaseHandler
- FacebookService::QueuedLogMessageHandler
- Defined in:
- lib/extras/queued_log_message_handler.rb
Instance Attribute Summary collapse
-
#message_limit ⇒ Object
If message_limit is exceeded, the handler will not accept any more messages from Scribe.
-
#queue ⇒ Object
readonly
Returns the value of attribute queue.
Instance Method Summary collapse
-
#initialize(name, opts = {}) ⇒ QueuedLogMessageHandler
constructor
A new instance of QueuedLogMessageHandler.
- #Log(messages) ⇒ Object
Methods inherited from BaseHandler
#aliveSince, #getCounter, #getCounters, #getCpuProfile, #getName, #getOption, #getOptions, #getStatus, #getStatusDetails, #getVersion, #reinitialize, #setOption, #shutdown
Constructor Details
#initialize(name, opts = {}) ⇒ QueuedLogMessageHandler
Returns a new instance of QueuedLogMessageHandler.
12 13 14 15 16 |
# File 'lib/extras/queued_log_message_handler.rb', line 12 def initialize(name, opts = {}) super(name) @queue = opts[:queue] || Queue.new end |
Instance Attribute Details
#message_limit ⇒ Object
If message_limit is exceeded, the handler will not accept any more messages from Scribe. The messages will be kept by Scribe and sent later.
10 11 12 |
# File 'lib/extras/queued_log_message_handler.rb', line 10 def @message_limit end |
#queue ⇒ Object (readonly)
Returns the value of attribute queue.
5 6 7 |
# File 'lib/extras/queued_log_message_handler.rb', line 5 def queue @queue end |
Instance Method Details
#Log(messages) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/extras/queued_log_message_handler.rb', line 18 def Log() if self..nil? || (.length + self.queue.size) <= self. .each do || self.queue.push() end ::ResultCode::OK else ::ResultCode::TRY_LATER end rescue Exception => e ::ResultCode::TRY_LATER end |