ActionScheduler_QueueCleaner
Located in classes/ActionScheduler_QueueCleaner.php.
Provides cleanup routines for old actions, timed-out claims, and long-running failures.
Public Methods
__construct( ?ActionScheduler_Store $store = null, $batch_size = 20 )
Initialize the cleaner.
- Parameters:
$store(ActionScheduler_Store|null),$batch_size(int)
delete_old_actions()
Delete completed/canceled actions older than the retention period.
- Returns:
arraydeleted action IDs
Filters:
action_scheduler_retention_period— retention age in seconds (default 31 days).action_scheduler_default_cleaner_statuses— statuses to purge.
clean_actions( array $statuses_to_purge, DateTime $cutoff_date, $batch_size = null, $context = 'old' )
Delete actions by status and cutoff date.
- Parameters:
$statuses_to_purge(string[])$cutoff_date(DateTime)$batch_size(int|null)$context(string) used in failure hooks
- Returns:
arraydeleted action IDs
reset_timeouts( $time_limit = 300 )
Unclaim pending actions that have been running longer than the timeout period.
- Parameters:
$time_limit(int) seconds - Returns:
void
Filters:
action_scheduler_timeout_period— timeout window in seconds.
Actions:
action_scheduler_reset_action— fired for each unclaimed action.
mark_failures( $time_limit = 300 )
Mark running actions as failed when they exceed the failure period.
- Parameters:
$time_limit(int) seconds - Returns:
void
Filters:
action_scheduler_failure_period— failure window in seconds.
Actions:
action_scheduler_failed_action— fired for each failed action.
clean( $time_limit = 300 )
Run the full cleanup process: old actions, timeouts, and failures.
- Parameters:
$time_limit(int) seconds - Returns:
void
Protected Methods
get_batch_size()
Return the batch size for cleanup runs.
- Returns:
int
Filters:
action_scheduler_cleanup_batch_size