Skip to content

fix(server): Skip moved sites when a recovery rebuilds the source nginx - #659

Open
regdocs wants to merge 1 commit into
developfrom
fix/recover-pull-ignore-missing-site-config
Open

regdocs wants to merge 1 commit into
developfrom
fix/recover-pull-ignore-missing-site-config

Conversation

@regdocs

@regdocs regdocs commented Nov 1, 2026 •

Copy link
Copy Markdown
Member

Problem

Two sites on the same bench can update to a new bench at the same time. If both updates fail, Press starts two recovery jobs at the same time. Each recovery job:

  1. moves its site from the new bench back to the old bench,
  2. rebuilds the nginx config of the new bench (source.setup_nginx()).

The nginx rebuild lists every site in the bench, and then reads each site's site_config.json for its domains and CORS settings. If the other recovery job moves its site out between these two reads, the read fails:

FileNotFoundError: [Errno 2] No such file or directory: '.../sites/<other site>/site_config.json'

The recovery job then fails. Its nginx reload and "Disable Maintenance Mode" steps do not run, so the site stays in maintenance mode.

Fix

Commit 7b82b1b added ignore_missing_site_configs=True for this race, but only in update_site_pull_job and update_site_migrate_job. This PR passes the same flag in update_site_recover_pull_job and update_site_recover_migrate_job.

With the flag, the rebuild removes the moved site from its list and tries again. A site that left the bench does not belong in that bench's nginx config, so the result is correct.

Tests

Two tests check that both recovery jobs pass the flag to the source bench's setup_nginx.

🤖 Generated with Claude Code

When two site updates from the same bench fail together, Press starts
two recovery jobs at once. Each job moves its site back and then rebuilds
the nginx config of the bench the sites failed on. One job can list the
other site, and that site can then move out before the job reads its
site_config.json. The job then fails with FileNotFoundError, and the site
stays in maintenance mode.

The update pull and migrate jobs already pass
ignore_missing_site_configs=True for this race. Pass it in the recover
pull and recover migrate jobs too. A site that left the bench does not
belong in its nginx config, so skipping it gives the correct result.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@regdocs regdocs self-assigned this Nov 1, 2026
@mergify

mergify Bot commented Nov 1, 2026

Copy link
Copy Markdown
Contributor

Tick the box to add this pull request to the merge queue (same as @mergifyio queue).

  • Queue this pull request

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant