Files
aptly/api
André Roth b7969c7a2d fix(publish): reload published inside task for update/switch endpoints
Affected endpoints: apiPublishUpdateSwitch (PUT), apiPublishUpdate (POST).

Both handlers loaded the published repo and mutated scalar fields
(Label, Origin, SkipContents, SkipBz2, AcquireByHash, SignedBy,
MultiDist, Version) outside the task closure, before the lock was
acquired.  Inside the task, LoadComplete only refreshed sourceItems —
it did not reload scalar fields or the Revision.  Two concurrent
requests therefore each operated on a stale base:

  Request A loads published (Label="old"), sets Label="A"
  Request B loads published (Label="old"), sets Label="B"
  Task A runs: Update() + Publish() + collection.Update() -> saves Label="A"
  Task B runs: Update() on B's stale copy -> saves Label="B",
               silently discarding A's Label change and potentially
               reconciling a Revision built against the pre-A state.

Fix: remove all field mutations and the LoadComplete call from the HTTP
handler.  Inside the task, a fresh taskCollectionFactory is created, the
published repo is re-read via ByStoragePrefixDistribution + LoadComplete
(obtaining the current DB state after the lock is held), and then all
field mutations are applied before Update / Publish / collection.Update.
2026-05-23 13:54:50 +02:00
..
2025-08-20 19:41:26 +02:00
2025-04-26 13:29:50 +02:00
2024-10-01 01:07:09 +02:00
2026-01-11 14:26:56 +01:00
2026-01-11 14:26:56 +01:00
2026-04-26 17:44:25 +02:00
2026-05-04 11:35:55 +02:00
2024-12-11 10:40:44 +01:00
2023-02-20 13:42:50 +01:00
2026-04-26 18:37:36 +02:00
2026-05-04 11:35:55 +02:00
2024-12-11 11:19:46 +01:00
2026-05-04 11:35:55 +02:00
2026-04-26 23:56:05 +02:00
2024-12-11 10:40:44 +01:00
2024-12-11 10:40:44 +01:00
2024-12-11 11:19:46 +01:00