Skip to content

Debian Package Registry: use a database transaction when creating multiple objects

Everyone can contribute. Help move this issue forward while earning points, leveling up and collecting rewards.

🔥 Problem

Looking at this part of the Debian Repository, it seems that the upload endpoint can end up creating multiple database records.

The problem is that I don't see any transaction being used. This could lead to inconsistent situations where half of the records are persisted but not the others.

🚒 Solution

  • Use a database transaction.
  • ⚠️ There is a background job that gets enqueued and we can't enqueue jobs in a transaction. Use app/models/concerns/after_commit_queue.rb.
Edited by 🤖 GitLab Bot 🤖