class ElasticAPM::TimedWorker
def process_messages
def process_messages should_exit = false while (msg = messages.pop(true)) case msg when ErrorMsg post_error msg when StopMsg should_exit = true # empty collected transactions before exiting collect_and_send_transactions end end rescue ThreadError # queue empty Thread.exit if should_exit end