Class: Timber::LogDevices::HTTP::DroppingSizedQueue
- Inherits:
-
SizedQueue
- Object
- SizedQueue
- Timber::LogDevices::HTTP::DroppingSizedQueue
- Defined in:
- lib/timber/log_devices/http.rb
Overview
Works like SizedQueue, but drops message instead of blocking. Pass one of these in to HTTP#intiialize via the :request_queue option if you’d prefer to drop messages in the event of a buffer overflow instead of applying back pressure.
Instance Method Summary collapse
-
#push(obj) ⇒ Object
Returns true/false depending on whether the queue is full or not.
Instance Method Details
#push(obj) ⇒ Object
Returns true/false depending on whether the queue is full or not
45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/timber/log_devices/http.rb', line 45 def push(obj) @mutex.synchronize do return false unless @que.length < @max @que.push obj begin t = @waiting.shift t.wakeup if t rescue ThreadError retry end return true end end |