From 85c4b04814ab31f23005a47229399a4b8c61127b Mon Sep 17 00:00:00 2001 From: David Stone Date: Fri, 10 Apr 2026 23:21:04 -0600 Subject: [PATCH] fix: remove dual retry path in check_pending_site_created MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit When a stale is_publishing flag is detected and reset, the code was both enqueuing wu_async_publish_pending_site via Action Scheduler AND returning publish_status=stopped to the frontend. This created two competing retry sources that could trigger double site creation. Remove the wu_enqueue_async_action call. The frontend polling loop retries on 'stopped' status, and the existing AS scheduled action will pick up the reset flag on its next run — a single retry path is sufficient. Fixes #793 --- inc/managers/class-membership-manager.php | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/inc/managers/class-membership-manager.php b/inc/managers/class-membership-manager.php index f76aea2a..d5a919d8 100644 --- a/inc/managers/class-membership-manager.php +++ b/inc/managers/class-membership-manager.php @@ -219,11 +219,13 @@ public function check_pending_site_created() { ); /* - * Re-enqueue the async action so Action Scheduler retries - * the site creation without waiting for the next cron tick. + * Return 'stopped' so the frontend polling loop retries. + * Do NOT also enqueue wu_async_publish_pending_site here — + * that would create two competing retry sources (Action + * Scheduler + frontend) and risk double site creation. + * The existing AS scheduled action will pick up the reset + * flag on its next run. */ - wu_enqueue_async_action('wu_async_publish_pending_site', ['membership_id' => $membership->get_id()], 'membership'); - wp_send_json(['publish_status' => 'stopped']); exit;