rollbar-gem icon indicating copy to clipboard operation
rollbar-gem copied to clipboard

Add option to bound thread queue?

Open croaky opened this issue 3 years ago • 0 comments

In Rollbar::Delay::Thread, it doesn't look like the thread queue is bounded. This could pose a problem if the app starts logging exceptions at high volume in a loop?

What do you think of an adding an option like this?

--- lib/rollbar/delay/thread.rb
+++ lib/rollbar/delay/thread.rb
@@ -16,6 +16,11 @@ module Rollbar
         attr_reader :reaper
 
         def call(payload)
+          if option[:max_queue] && threads.length > options[:max_queue]
+            # enforce a bounded thread queue
+            return
+          end

Configured like this:

config.use_thread(max_queue: 5)

croaky avatar Jan 31 '21 19:01 croaky