A job enqueued inside a transaction may run before the transaction commits (seeing stale data or missing rows), or be committed to Redis even though the transaction later rolls back. Moving the enqueue to the end of the transaction is not a guaranteed fix. This has been a long-standing Sidekiq problem; Sidekiq 7 finally addresses it, making jobs queued at the end of a transaction wait until commit before executing.