Automattic\WooCommerce\Internal\Logging
OrderLogsCleanupHelper::schedule_extended_cleanup
Schedule a follow-up cleanup run to continue draining the backlog.
Method of the class: OrderLogsCleanupHelper{}
No Hooks.
Returns
null. Nothing (null).
Usage
// private - for code of main (parent) class only $result = $this->schedule_extended_cleanup(): void;
OrderLogsCleanupHelper::schedule_extended_cleanup() OrderLogsCleanupHelper::schedule extended cleanup code WC 11.0.1
private function schedule_extended_cleanup(): void {
if ( ! function_exists( 'as_schedule_single_action' ) || ! function_exists( 'as_get_scheduled_actions' ) ) {
return;
}
// Only pending actions count: when this runs as the extended cleanup callback, the
// current action is in-progress and would otherwise match, blocking the follow-up.
$pending = as_get_scheduled_actions(
array(
'hook' => self::EXTENDED_CLEANUP_HOOK,
'args' => array(),
'group' => 'woocommerce',
'status' => \ActionScheduler_Store::STATUS_PENDING,
'per_page' => 1,
'orderby' => 'none',
),
'ids'
);
if ( $pending ) {
return;
}
as_schedule_single_action( time() + self::EXTENDED_CLEANUP_DELAY, self::EXTENDED_CLEANUP_HOOK, array(), 'woocommerce' );
}