Skip to content

Instantly share code, notes, and snippets.

@coorasse
Last active June 8, 2018 07:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save coorasse/395433b21f787751e3f0861b5bb14409 to your computer and use it in GitHub Desktop.
Save coorasse/395433b21f787751e3f0861b5bb14409 to your computer and use it in GitHub Desktop.
Sending Sentry Raven events asynchronously with ActiveJob
Raven.configure(true) do |config|
config.async = ->(event) { SentryJob.perform_later(event) }
end
class SentryJob < ActiveJob::Base
queue_as :default
before_enqueue do |job|
job.arguments[0] = job.arguments[0].to_hash if job.arguments[0]
end
def perform(event)
Raven.send_event(event) if defined?(Raven)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment