Discard dispatch jobs of already deleted records
This commit is contained in:
parent
619bc3f537
commit
4b754b51f9
2 changed files with 10 additions and 0 deletions
|
|
@ -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
|
||||
|
|
|
|||
9
spec/workers/deferred_dispatch_spec.rb
Normal file
9
spec/workers/deferred_dispatch_spec.rb
Normal 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
|
||||
Loading…
Reference in a new issue