Skip to content

fix(membership): reset is_publishing on thrown exceptions in publish_pending_site#421

Merged
superdav42 merged 1 commit into
mainfrom
bugfix/qd-412-membership
Mar 25, 2026
Merged

fix(membership): reset is_publishing on thrown exceptions in publish_pending_site#421
superdav42 merged 1 commit into
mainfrom
bugfix/qd-412-membership

Conversation

@superdav42

Copy link
Copy Markdown
Collaborator

Summary

Addresses the unactioned CodeRabbit review feedback from PR #372, tracked in issue #412.

Finding (medium severity): The rollback that clears the pending site's is_publishing flag only ran when Site::save() returned a WP_Error. If Site::save() or a downstream hook threw a Throwable (PHP exception or Error), the pending site remained stuck in the "Creating" state and the cron/manual retry path could not recover.

Fix: Wrap the Site::save() call in try/catch(\Throwable $e) so that both WP_Error returns and thrown exceptions reset is_publishing and return a WP_Error to the caller.

Changes

  • inc/models/class-membership.php — wrap $pending_site->save() in try/catch(\Throwable) in publish_pending_site() (1 file, 15 lines added)

Blast radius

1 file changed. Well within the 5-file quality-debt cap.

Closes #412

…pending_site

Addresses PR #372 CodeRabbit review feedback (issue #412).

The rollback that clears the pending site's 'publishing' flag previously only
ran when Site::save() returned a WP_Error. If Site::save() or a downstream
hook threw a Throwable (e.g. a PHP exception or Error), the pending site
remained stuck in 'Creating' state and the cron/manual retry path could not
recover.

Wrap the Site::save() call in try/catch(\Throwable) so that both WP_Error
returns and thrown exceptions reset is_publishing and return a WP_Error to
the caller.
@coderabbitai

coderabbitai Bot commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Warning

Rate limit exceeded

@superdav42 has exceeded the limit for the number of commits that can be reviewed per hour. Please wait 10 minutes and 45 seconds before requesting another review.

⌛ How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 41b1da03-287d-4b33-beea-222932aeda20

📥 Commits

Reviewing files that changed from the base of the PR and between a71624d and a914916.

📒 Files selected for processing (1)
  • inc/models/class-membership.php
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch bugfix/qd-412-membership

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@github-actions

Copy link
Copy Markdown

🔨 Build Complete - Ready for Testing!

📦 Download Build Artifact (Recommended)

Download the zip build, upload to WordPress and test:

🌐 Test in WordPress Playground (Very Experimental)

Click the link below to instantly test this PR in your browser - no installation needed!
Playground support for multisite is very limitied, hopefully it will get better in the future.

🚀 Launch in Playground

Login credentials: admin / password

@superdav42 superdav42 merged commit c3c223e into main Mar 25, 2026
10 checks passed
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.

quality-debt: inc/models/class-membership.php — PR #372 review feedback (medium)

1 participant