Discard dispatch jobs of already deleted records

This commit is contained in:
Jonne Haß 2014-09-20 13:39:09 +02:00
parent 619bc3f537
commit 4b754b51f9
2 changed files with 10 additions and 0 deletions

View file

@ -17,6 +17,7 @@ module Workers
end
Postzord::Dispatcher.build(user, object, opts).post
rescue ActiveRecord::RecordNotFound # The target got deleted before the job was run
end
end
end

View file

@ -0,0 +1,9 @@
require 'spec_helper'
describe Workers::DeferredDispatch do
it "handles non existing records gracefully" do
expect {
described_class.new.perform(alice.id, 'Comment', 0, {})
}.to_not raise_error
end
end