You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@zspencer, I was thinking to wrap the block in a transaction like you suggested and use after_commit callback to run the sidekiq jobs. This would ensure that only after the transaction succeeds the next steps would be executed.
To be specific the below lines would be placed inside the after_commit callback
Order::ReceivedMailer.notification(order).deliver_laterorder.events.create(description: "Notifications to Vendor and Distributor Sent")Order::PlacedMailer.notification(order).deliver_laterorder.events.create(description: "Notification to Buyer Sent")SplitJob.perform_later(order: order)
Our current implementation can leave orders in strange spots if they fail in the middle.
On the one hand, this is good because we don't want to redo important steps that have already happened.
On the other, it's not great because if step B updates the order to paid and step C fails then D and E don't happen and never will.
It would probably be better to either:
Thoughts?
The text was updated successfully, but these errors were encountered: