ActionScheduler_QueueCleaner::reset_timeouts() – Unclaim pending actions that have not been run within a given time limit.

You appear to be a bot. Output may be restricted

Description

Unclaim pending actions that have not been run within a given time limit.

When called by ActionScheduler_Abstract_QueueRunner::run_cleanup(), the time limit passed as a parameter is 10x the time limit used for queue processing.

Usage

ActionScheduler_QueueCleaner::reset_timeouts( $time_limit );

Parameters

$time_limit
( int ) optional default: 300 – The number of seconds to allow a queue to run before unclaiming its pending actions. Default 300 (5 minutes).

Returns

void

Source

File name: woocommerce/packages/action-scheduler/classes/ActionScheduler_QueueCleaner.php
Lines:

1 to 20 of 20
  public function reset_timeouts( $time_limit = 300 ) {
    $timeout = apply_filters( 'action_scheduler_timeout_period', $time_limit );
    if ( $timeout < 0 ) {
      return;
    }
    $cutoff = as_get_datetime_object($timeout.' seconds ago');
    $actions_to_reset = $this->store->query_actions( array(
      'status'           => ActionScheduler_Store::STATUS_PENDING,
      'modified'         => $cutoff,
      'modified_compare' => '<=',
      'claimed'          => true,
      'per_page'         => $this->get_batch_size(),
      'orderby'          => 'none',
    ) );

    foreach ( $actions_to_reset as $action_id ) {
      $this->store->unclaim_action( $action_id );
      do_action( 'action_scheduler_reset_action', $action_id );
    }
  }
 

 View on GitHub View on Trac