• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar
  • Skip to footer
WooCommerce a2z

WooCommerce a2z

WooCommerce

  • Home
  • Plugins
  • Blocks
  • Shortcodes
  • APIs
  • Classes
  • Files
  • Hooks
  • Sitemap
  • Blog
Home / APIs / 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(),
    ) );

    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

Published: 26th November 2019 | Last updated: 6th April 2020

Primary Sidebar

Information

Function name: ActionScheduler_QueueCleaner::reset_timeouts
Class ref: ActionScheduler_QueueCleaner
Plugin ref: WooCommerce
Version: 5.1.0
Sourcefile: packages/action-scheduler/classes/ActionScheduler_QueueCleaner.php
File ref: packages/action-scheduler/classes/ActionScheduler_QueueCleaner.php
Deprecated?: No
API Letters: A,Q,R,T

Footer

WooCommerce a2z
WooCommerce a2z
WooCommerce
WordPress 5.7
WordPress a2z
WordPress core a2z
Genesis Theme Framework a2z
Jetpack a2z
WordPress develop tests
Easy Digital Downloads a2z
WooCommerce a2z
Yoast SEO a2z
WordPress Blocks

Site:  woocommerce.wp-a2z.org
© Copyright WooCommerce a2z 2014-2021. All rights reserved.


Website designed and developed by Herb Miller
Proudly powered by WordPress and oik plugins

  • Home
  • Blog
  • Sitemap
  • Sites