Taste profile: concurrent updates can overwrite each other's fields #213

Open
opened 2026-12-01 22:34:03 +01:00 by midas · 0 comments
Owner

Left out of scope in #211 (fix for #207).

TasteProfileService loads the profile row, changes some fields and saves the whole entity. Two concurrent transactions on an existing row (for example a recalculation triggered by TasteProfileInvalidatedEvent and PUT of the preferred languages or excluded regions) each write every column, so the later commit can restore an old value of a field it did not mean to touch. No error is raised; the update is silently lost.

Options

  • Optimistic locking (@Version) with a retry on the recalculation path.
  • Targeted updates: recalculation writes only the computed columns, the preference endpoints write only their own column.

The second is simpler and removes the conflict rather than detecting it.

Left out of scope in #211 (fix for #207). `TasteProfileService` loads the profile row, changes some fields and saves the whole entity. Two concurrent transactions on an existing row (for example a recalculation triggered by `TasteProfileInvalidatedEvent` and `PUT` of the preferred languages or excluded regions) each write every column, so the later commit can restore an old value of a field it did not mean to touch. No error is raised; the update is silently lost. ## Options - Optimistic locking (`@Version`) with a retry on the recalculation path. - Targeted updates: recalculation writes only the computed columns, the preference endpoints write only their own column. The second is simpler and removes the conflict rather than detecting it.
Sign in to join this conversation.
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
midas/podradar#213
No description provided.