Commit 3bbed532ea7 for woocommerce
commit 3bbed532ea7ab5e58e677319870ddf4ff9c6b60e
Author: Barry Hughes <3594411+barryhughes@users.noreply.github.com>
Date: Thu Oct 29 13:03:26 2026 -0700
Migrate single and async scheduling calls in internal services to ActionSchedulerUtil (#70156)
BatchProcessingController, the push notification retry handler and pending store, StoredStateSetupForProducts, DraftOrders and the POS catalog AsyncGenerator call the util. AsyncGenerator's feed deletion drops its explicit unique = false argument and stays a direct call.
Split from #69847 (WOOPLUG-2435).
Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
diff --git a/plugins/woocommerce/changelog/update-wooplug-2435-migrate-as-calls-internal-services b/plugins/woocommerce/changelog/update-wooplug-2435-migrate-as-calls-internal-services
new file mode 100644
index 00000000000..015a2bb07cd
--- /dev/null
+++ b/plugins/woocommerce/changelog/update-wooplug-2435-migrate-as-calls-internal-services
@@ -0,0 +1,3 @@
+Significance: patch
+Type: update
+Comment: Covered by the base PR changelog entry (#69846).
diff --git a/plugins/woocommerce/src/Admin/RemoteSpecs/RuleProcessors/StoredStateSetupForProducts.php b/plugins/woocommerce/src/Admin/RemoteSpecs/RuleProcessors/StoredStateSetupForProducts.php
index bde76df21e9..e7bf3846aa7 100644
--- a/plugins/woocommerce/src/Admin/RemoteSpecs/RuleProcessors/StoredStateSetupForProducts.php
+++ b/plugins/woocommerce/src/Admin/RemoteSpecs/RuleProcessors/StoredStateSetupForProducts.php
@@ -8,6 +8,7 @@ namespace Automattic\WooCommerce\Admin\RemoteSpecs\RuleProcessors;
defined( 'ABSPATH' ) || exit;
use Automattic\WooCommerce\Admin\RemoteInboxNotifications\RemoteInboxNotificationsEngine;
+use Automattic\WooCommerce\Internal\Utilities\ActionSchedulerUtil;
/**
* Handles stored state setup for products.
@@ -127,6 +128,6 @@ class StoredStateSetupForProducts {
RemoteInboxNotificationsEngine::update_stored_state( $stored_state );
// Run self::run_remote_notifications asynchronously.
- as_enqueue_async_action( self::ASYNC_RUN_REMOTE_NOTIFICATIONS_ACTION_NAME );
+ ActionSchedulerUtil::enqueue_async( self::ASYNC_RUN_REMOTE_NOTIFICATIONS_ACTION_NAME );
}
}
diff --git a/plugins/woocommerce/src/Blocks/Domain/Services/DraftOrders.php b/plugins/woocommerce/src/Blocks/Domain/Services/DraftOrders.php
index 49d609e122c..360bc242d13 100644
--- a/plugins/woocommerce/src/Blocks/Domain/Services/DraftOrders.php
+++ b/plugins/woocommerce/src/Blocks/Domain/Services/DraftOrders.php
@@ -207,8 +207,8 @@ class DraftOrders {
++$count;
}
}
- if ( $batch_size === $count && function_exists( 'as_enqueue_async_action' ) ) {
- as_enqueue_async_action( self::DRAFT_CLEANUP_EVENT_HOOK );
+ if ( $batch_size === $count ) {
+ ActionSchedulerUtil::enqueue_async( self::DRAFT_CLEANUP_EVENT_HOOK );
}
} catch ( Exception $error ) {
wc_caught_exception( $error, __METHOD__ );
diff --git a/plugins/woocommerce/src/Internal/BatchProcessing/BatchProcessingController.php b/plugins/woocommerce/src/Internal/BatchProcessing/BatchProcessingController.php
index 33c3fcbf2f6..924e5cdd73a 100644
--- a/plugins/woocommerce/src/Internal/BatchProcessing/BatchProcessingController.php
+++ b/plugins/woocommerce/src/Internal/BatchProcessing/BatchProcessingController.php
@@ -383,7 +383,7 @@ class BatchProcessingController {
}
if ( ! ActionSchedulerUtil::has_scheduled_action( self::WATCHDOG_ACTION_NAME ) ) {
- as_schedule_single_action(
+ ActionSchedulerUtil::schedule_single(
$time,
self::WATCHDOG_ACTION_NAME,
array(),
diff --git a/plugins/woocommerce/src/Internal/ProductFeed/Integrations/POSCatalog/AsyncGenerator.php b/plugins/woocommerce/src/Internal/ProductFeed/Integrations/POSCatalog/AsyncGenerator.php
index 373a8f65c25..5b3420f4059 100644
--- a/plugins/woocommerce/src/Internal/ProductFeed/Integrations/POSCatalog/AsyncGenerator.php
+++ b/plugins/woocommerce/src/Internal/ProductFeed/Integrations/POSCatalog/AsyncGenerator.php
@@ -15,6 +15,7 @@ use Automattic\WooCommerce\Internal\ProductFeed\Feed\FeedLockException;
use Automattic\WooCommerce\Internal\ProductFeed\Feed\ProductWalker;
use Automattic\WooCommerce\Internal\ProductFeed\Feed\ResumableFeedInterface;
use Automattic\WooCommerce\Internal\ProductFeed\Feed\WalkerProgress;
+use Automattic\WooCommerce\Internal\Utilities\ActionSchedulerUtil;
if ( ! defined( 'ABSPATH' ) ) {
exit;
@@ -172,7 +173,7 @@ class AsyncGenerator {
// group only (not args) and treats a running action as a blocker, so a unique enqueue of the next
// chunk would be rejected while the current chunk's action is still running. Per-job de-duplication
// is handled by as_unschedule_all_actions() in get_status() instead.
- as_enqueue_async_action(
+ ActionSchedulerUtil::enqueue_async(
self::FEED_GENERATION_ACTION,
array( $option_key ),
'woo-product-feed',
@@ -286,8 +287,7 @@ class AsyncGenerator {
time() + self::FEED_EXPIRY,
self::FEED_DELETION_ACTION,
array( $option_key, $feed->get_file_path() ),
- 'woo-product-feed',
- false
+ 'woo-product-feed'
);
} else {
$feed->flush();
diff --git a/plugins/woocommerce/src/Internal/PushNotifications/Services/NotificationRetryHandler.php b/plugins/woocommerce/src/Internal/PushNotifications/Services/NotificationRetryHandler.php
index 356cce30a6a..a87a58a15f3 100644
--- a/plugins/woocommerce/src/Internal/PushNotifications/Services/NotificationRetryHandler.php
+++ b/plugins/woocommerce/src/Internal/PushNotifications/Services/NotificationRetryHandler.php
@@ -7,6 +7,7 @@ namespace Automattic\WooCommerce\Internal\PushNotifications\Services;
defined( 'ABSPATH' ) || exit;
use Automattic\WooCommerce\Internal\PushNotifications\Notifications\Notification;
+use Automattic\WooCommerce\Internal\Utilities\ActionSchedulerUtil;
use Exception;
/**
@@ -168,7 +169,7 @@ class NotificationRetryHandler {
$args['extra'] = $identity_data;
}
- $action_id = as_schedule_single_action(
+ $action_id = ActionSchedulerUtil::schedule_single(
time() + $delay,
self::RETRY_HOOK,
$args,
diff --git a/plugins/woocommerce/src/Internal/PushNotifications/Services/PendingNotificationStore.php b/plugins/woocommerce/src/Internal/PushNotifications/Services/PendingNotificationStore.php
index 0fc9253223c..97111f5910f 100644
--- a/plugins/woocommerce/src/Internal/PushNotifications/Services/PendingNotificationStore.php
+++ b/plugins/woocommerce/src/Internal/PushNotifications/Services/PendingNotificationStore.php
@@ -195,7 +195,7 @@ class PendingNotificationStore {
// Action Scheduler returns 0 rather than throwing when it cannot store
// the job, and a notification whose fallback was never scheduled has
// nothing to catch it if the loopback does not arrive.
- $action_id = as_schedule_single_action(
+ $action_id = ActionSchedulerUtil::schedule_single(
time() + NotificationProcessor::SAFETY_NET_DELAY,
NotificationProcessor::SAFETY_NET_HOOK,
$args,