From 032119a8ce98f77e91134c90a03d4cdd431a7e7f Mon Sep 17 00:00:00 2001 From: Mykyta Synelnikov Date: Wed, 18 Jun 2025 15:17:19 +0300 Subject: [PATCH] Refactor batch action scheduling for account status updates (#1692) Updated batch action logic to utilize correct constants and ensure proper scheduling. Added fallback scheduling logic in admin notices to address unscheduled batch actions and improve reliability. --- includes/admin/core/class-admin-notices.php | 9 +++++++++ includes/core/class-setup.php | 4 ++-- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/includes/admin/core/class-admin-notices.php b/includes/admin/core/class-admin-notices.php index be73e0f4..3c8f0a30 100644 --- a/includes/admin/core/class-admin-notices.php +++ b/includes/admin/core/class-admin-notices.php @@ -1,6 +1,8 @@ maybe_action_scheduler()->has_scheduled_action( Users::BATCH_ACTION ) ) { + do_action( Users::SCHEDULE_ACTION ); + } + $allowed_html = array( 'a' => array( 'href' => array(), diff --git a/includes/core/class-setup.php b/includes/core/class-setup.php index eb6d37f4..21cd1fbd 100644 --- a/includes/core/class-setup.php +++ b/includes/core/class-setup.php @@ -316,9 +316,9 @@ KEY meta_value_indx (um_value(191)) } // If there are some users without `account_status` then run the first async batch for update. - $batch_size = 50; // See the class constant value `\um\common\actions\Users::BATCH_ACTION`. + $batch_size = 50; // See the class constant value `\um\common\actions\Users::BATCH_SIZE`. UM()->maybe_action_scheduler()->enqueue_async_action( - $batch_size, + 'um_set_default_account_status', // See the class constant value `\um\common\actions\Users::BATCH_ACTION`. array( 'page' => 1, 'total' => $total_users,