Sha256: 21c29943fa93766621504465c4d0e9ce153bc6a27ec689d72b0423e1fed88237
Contents?: true
Size: 656 Bytes
Versions: 8
Compression:
Stored size: 656 Bytes
Contents
require 'thread' module Bugsnag class Queue < ::Queue MAX_OUTSTANDING_REQUESTS = 100 STOP = Object.new def push(*) if length > MAX_OUTSTANDING_REQUESTS Bugsnag.warn("Dropping notification, #{length} outstanding requests") return end @thread ||= create_processor super end private def create_processor t = Thread.new do while x = pop break if x == STOP x.call end end at_exit do Bugsnag.warn("Waiting for #{length} outstanding request(s)") unless empty? push STOP t.join end t end end end
Version data entries
8 entries across 8 versions & 1 rubygems