mirror of
https://github.com/we-promise/sure.git
synced 2026-05-31 16:29:03 +00:00
* refactor(accounts): Improve destroy_later atomicity and add controller error handling * Address PR comment --------- Co-authored-by: sentry[bot] <39604003+sentry[bot]@users.noreply.github.com> Co-authored-by: Juan José Mata <juanjo.mata@gmail.com>
11 lines
271 B
Ruby
11 lines
271 B
Ruby
class DestroyJob < ApplicationJob
|
|
queue_as :low_priority
|
|
self.enqueue_after_transaction_commit = :never
|
|
|
|
def perform(model)
|
|
model.destroy
|
|
rescue => e
|
|
model.update!(scheduled_for_deletion: false) # Let's the user try again by resetting the state
|
|
end
|
|
end
|