[openstreetmap/openstreetmap-website] Discard jobs when then encounter a deserialization error (PR #4323)

Tom Hughes notifications at github.com
Wed Nov 15 19:04:17 UTC 2023


> [The docs for `ActiveJob:DeserializationError`](https://edgeapi.rubyonrails.org/classes/ActiveJob/DeserializationError.html) suggest that the original error is available wrapped within that one, so perhaps it might be possible to discard only the jobs that raise a NotFound error during deserialization?

I was starting to think that it wasn't possible because there's no way to attach a condition to `on_discard` to inspect the contents but then I looked at how it's implemented and it comes down to https://github.com/rails/rails/blob/6b93fff8af32ef5e91f4ec3cfffb081d0553faf0/activesupport/lib/active_support/rescuable.rb#L90 which, if it doesn't find a handle for `exception` will look for one for `exception.cause` instead which is just what we need!

-- 
Reply to this email directly or view it on GitHub:
https://github.com/openstreetmap/openstreetmap-website/pull/4323#issuecomment-1813100001
You are receiving this because you are subscribed to this thread.

Message ID: <openstreetmap/openstreetmap-website/pull/4323/c1813100001 at github.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.openstreetmap.org/pipermail/rails-dev/attachments/20231115/88bb5e3b/attachment-0001.htm>


More information about the rails-dev mailing list