Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

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.


We 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

The discussion was then continued here: https://github.com/rails/rails/pull/16485#discussion-diff-16..., which is where the `ActiveJob::DeserializationError` comes from.


This 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#globali... for an example.)




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: