3 ms·
We frequently ran into the issue of the object having been deleted while sitting in the job queue, so Model.find(id) would blow up. I'd be curious to hear if Gl
by sync 12y ago
We frequently ran into the issue of the object having been deleted while sitting in the job queue, so Model.find(id) would blow up. I'd be curious to hear if GlobalID did anything about that.
- damncabbage 12y agoThis won't do anything for you there; it just collapses a Class and a record ID down into a string for you (and then pulls it back out of your database later with a GlobalID::Locator.locate(string) call). It's not full-record-serialization, and it can't bring back deleted records for you. (See https://github.com/rails/rails/tree/master/activejob#globalid-support https://github.com/rails/rails/tree/master/activejob#globali... for an example.)
- DouweM 12y agoWe had a bit of a discussion about that, finally settling on adding `rescue_from` which you'll know from ActionController and raising a `ActiveJob::DeserializationError` wrapping `ActiveRecord::RecordNotFound`, allowing you to handle this lookup failure however you see fit. See the original discussion here: https://github.com/rails/activejob/issues/25 https://github.com/rails/activejob/issues/25 The discussion was then continued here: https://github.com/rails/rails/pull/16485#discussion-diff-16273182 https://github.com/rails/rails/pull/16485#discussion-diff-16..., which is where the `ActiveJob::DeserializationError` comes from.