Transaction-Safe After-Commit Hook (Avoid Ghost Jobs)

4250
0

Enqueueing jobs inside a transaction can create “ghost jobs” when the transaction rolls back. Use after_commit or after_create_commit to enqueue work only after the DB commit succeeds.