Skip to content

[BUGFIX] Lock site settings while loading, merging and writing - #34

Open
sfsmfc wants to merge 2 commits into
developfrom
bugfix/lock-site-settings-writes
Open

sfsmfc wants to merge 2 commits into
developfrom
bugfix/lock-site-settings-writes

Conversation

@sfsmfc

@sfsmfc sfsmfc commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Parallel requests load, merge and write settings.yaml at the same time. This can create a second API key or a second registration, or overwrite an API key that another request wrote a moment before.

Hold a lock per site while loading, merging and writing, also in the upgrade wizard. The lock does not wait: when another request holds it, the status sync and the API key provisioning skip, and the registration stops before it calls the middleware. After the lock is acquired, check the settings file again for an existing API key or registration. A busy lock or an existing registration returns 409 with a clear message instead of a failed registration.


Parallel requests load, merge and write settings.yaml at the same
time. This can create a second API key or a second registration, or
overwrite an API key that another request wrote a moment before.

Hold a lock per site while loading, merging and writing, also in the
upgrade wizard. The lock does not wait: when another request holds
it, the status sync and the API key provisioning skip, and the
registration stops before it calls the middleware. After the lock is
acquired, check the settings file again for an existing API key or
registration. A busy lock or an existing registration returns 409
with a clear message instead of a failed registration.
The unit tests use the real lock factory. Mocks stay only for the lock
mode and for a failed acquire.
@buchmarv

Copy link
Copy Markdown

This seems connected to #42.
Let's merge it first and rebase this before review.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants