README.md in sentry-raven-2.5.1 vs README.md in sentry-raven-2.5.2
- old
+ new
@@ -97,14 +97,16 @@
Using a thread to send events will be adequate for truly parallel Ruby platforms such as JRuby, though the benefit on MRI/CRuby will be limited. If the async callback raises an exception, Raven will attempt to send synchronously.
We recommend creating a background job, using your background job processor, that will send Sentry notifications in the background. Rather than enqueuing an entire Raven::Event object, we recommend providing the Hash representation of an event as a job argument. Here’s an example for ActiveJob:
```ruby
-config.async = lambda { |event|
- SentryJob.perform_later(event.to_hash)
-}
+config.async = lambda { |event| SentryJob.perform_later(event) }
+
class SentryJob < ActiveJob::Base
queue_as :default
+
+ # Important! Otherwise, we can get caught in an infinite loop.
+ rescue_from(ActiveJob::DeserializationError) { |e| Rails.logger.error e }
def perform(event)
Raven.send_event(event)
end
end