Resque workers throwing ActiveRecord::RecordNotFound exception even though the job is executed after_save

I’ve been wondering how an ActiveRecord::RecordNotFound exception can occur even though I was running a background job after_save in the background. Turns out that until the database commit occurs, a query to find the record will return an empty result.

The following post saved my day:

http://logicalfriday.com/2012/08/21/rails-callbacks-workers-and-the-race-you-never-expected-to-lose/

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s