What is the best way to configure asynchronous configuration with Sidekiq? I don't want to pass the full Raven::Event instance to the Sidekiq worker so I'm thinking of doing something like this:
config.async = lambda do |event|
SentryWorker.perform_async(event_to_hash.to_json)
end
And then in my worker, I would convert the JSON back into a Raven::Event before calling Raven.send_event on it:
class SentryWorker
include Sidekiq::Worker
def perform(event_json)
event = create_event_from_json(event_json)
Raven.send_event(event)
rescue JSON::ParseError
end
end
I've looked through the Raven::Event source and there doesn't appear to be an obvious way to re-create the event from a hash. It'd be nice if there were Raven::Event.from_hash method, but in lieu of that should I create a new event in the worker and pass in the details from the hash. That approach seems possible with the exception of the interfaces portion of the object.
Am I missing something? Or am I on the right track?
What is the best way to configure asynchronous configuration with Sidekiq? I don't want to pass the full
Raven::Eventinstance to the Sidekiq worker so I'm thinking of doing something like this:And then in my worker, I would convert the JSON back into a
Raven::Eventbefore callingRaven.send_eventon it:I've looked through the
Raven::Eventsource and there doesn't appear to be an obvious way to re-create the event from a hash. It'd be nice if there wereRaven::Event.from_hashmethod, but in lieu of that should I create a new event in the worker and pass in the details from the hash. That approach seems possible with the exception of theinterfacesportion of the object.Am I missing something? Or am I on the right track?