Skip to content

Commit e47bc01

Browse files
committed
refactor: standardize ActionScheduler group names to 'newspack'
1 parent 03e8522 commit e47bc01

File tree

4 files changed

+8
-23
lines changed

4 files changed

+8
-23
lines changed

includes/data-events/class-data-events.php

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -81,11 +81,6 @@ final class Data_Events {
8181
*/
8282
private static $current_event = null;
8383

84-
/**
85-
* ActionScheduler group for dispatch actions.
86-
*/
87-
const DISPATCH_AS_GROUP = 'newspack-data-events-dispatch';
88-
8984
/**
9085
* ActionScheduler hook for handling dispatched events.
9186
*/
@@ -96,11 +91,6 @@ final class Data_Events {
9691
*/
9792
const HANDLER_RETRY_HOOK = 'newspack_data_events_retry_handler';
9893

99-
/**
100-
* ActionScheduler group for handler retry actions.
101-
*/
102-
const HANDLER_RETRY_GROUP = 'newspack-data-events-handler-retry';
103-
10494
/**
10595
* Maximum number of retries for a failed handler.
10696
*/
@@ -609,7 +599,7 @@ private static function dispatch_via_action_scheduler() {
609599
\as_enqueue_async_action(
610600
self::DISPATCH_AS_HOOK,
611601
[ self::$queued_dispatches ],
612-
self::DISPATCH_AS_GROUP
602+
'newspack'
613603
);
614604

615605
self::log( sprintf( 'Scheduled %d dispatch(es) via Action Scheduler.', count( self::$queued_dispatches ) ) );
@@ -725,7 +715,7 @@ private static function schedule_handler_retry( $handler, $action_name, $timesta
725715
time() + $backoff_seconds,
726716
self::HANDLER_RETRY_HOOK,
727717
[ $retry_data ],
728-
self::HANDLER_RETRY_GROUP
718+
'newspack'
729719
);
730720

731721
self::log(

includes/data-events/class-webhooks.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -732,7 +732,7 @@ private static function schedule_request( $request_id, $delay = 1 ) {
732732
$time,
733733
'newspack_webhooks_as_process_request',
734734
[ $request_id ],
735-
'newspack-data-events',
735+
'newspack',
736736
false,
737737
self::get_request_priority( $request_id )
738738
);

includes/plugins/woocommerce-subscriptions/class-on-hold-duration.php

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,6 @@ class On_Hold_Duration {
1818
*/
1919
const AS_HOOK = 'newspack_expire_manual_subscription';
2020

21-
/**
22-
* The group name for the manual subscription expiration scheduled action.
23-
*/
24-
const AS_GROUP = 'newspack_expire_manual_subscription';
25-
2621
/**
2722
* Initialize hooks and filters.
2823
*/
@@ -141,8 +136,8 @@ public static function maybe_schedule_expiration( $subscription ) {
141136
* @param int $timestamp Timestamp.
142137
*/
143138
public static function schedule_expiration( $subscription_id, $timestamp ) {
144-
if ( ! as_has_scheduled_action( self::AS_HOOK, [ $subscription_id ], self::AS_GROUP ) ) {
145-
as_schedule_single_action( $timestamp, self::AS_HOOK, [ $subscription_id ], self::AS_GROUP );
139+
if ( ! as_has_scheduled_action( self::AS_HOOK, [ $subscription_id ], 'newspack' ) ) {
140+
as_schedule_single_action( $timestamp, self::AS_HOOK, [ $subscription_id ], 'newspack' );
146141
}
147142
}
148143

@@ -152,8 +147,8 @@ public static function schedule_expiration( $subscription_id, $timestamp ) {
152147
* @param \WC_Subscription $subscription The Subscription.
153148
*/
154149
public static function maybe_unschedule_expiration( $subscription ) {
155-
if ( false !== as_has_scheduled_action( self::AS_HOOK, [ $subscription->get_id() ], self::AS_GROUP ) ) {
156-
as_unschedule_action( self::AS_HOOK, [ $subscription->get_id() ], self::AS_GROUP );
150+
if ( false !== as_has_scheduled_action( self::AS_HOOK, [ $subscription->get_id() ], 'newspack' ) ) {
151+
as_unschedule_action( self::AS_HOOK, [ $subscription->get_id() ], 'newspack' );
157152
}
158153
}
159154

includes/reader-activation/sync/class-contact-sync.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -181,7 +181,7 @@ private static function schedule_integration_retry( $integration_id, $contact, $
181181
time() + $backoff_seconds,
182182
self::RETRY_HOOK,
183183
[ $retry_data ],
184-
self::RETRY_GROUP
184+
'newspack'
185185
);
186186

187187
static::log(

0 commit comments

Comments
 (0)