I am using sucker punch with ActiveRecord and rails. I use sucker punch in an after_create callback of a rails model:
after_create :send_hooks
def send_hooks
WebhookJob.perform_async(klass:"Transcript",id:id,name:"transcript_created")
WebhookJob.perform_async(klass:"Transcript",id:self.id,name:"item_and_transcript_created")
TriggerJob.perform_async(id)
true
end
In each of those jobs, I call Transcript.find(id) . And every time send_hooks is called, I will get one of those jobs randomly failing with :
Sucker Punch job error for class: 'WebhookJob' args: [{:klass=>"Transcript", :id=>244, :name=>"transcript_created"}]
ActiveRecord::RecordNotFound Couldn't find Transcript with 'id'=244
The item exists for sure, because its happening in an after_create callback of rails. How is it possible for this kind of error to appear? I'm wondering if sucker punch jobs should not be called multiple times in a row? I also do have some of these jobs calling jobs from inside their jobs. Can sucker punch be used like that?
I am using sucker punch with ActiveRecord and rails. I use sucker punch in an after_create callback of a rails model:
In each of those jobs, I call Transcript.find(id) . And every time send_hooks is called, I will get one of those jobs randomly failing with :
The item exists for sure, because its happening in an after_create callback of rails. How is it possible for this kind of error to appear? I'm wondering if sucker punch jobs should not be called multiple times in a row? I also do have some of these jobs calling jobs from inside their jobs. Can sucker punch be used like that?