WC_Helper_API_Backoff::is_rate_limited │ public static │ WC 1.0

Whether a request type is currently within a backoff window.

A manual refresh always returns false and clears any recorded backoff, so clicking "Refresh" lets the user force a fresh request at any time.

Method of the class: WC_Helper_API_Backoff{}

No Hooks.

Returns

bool. True while the site should refrain from calling the endpoint.

Usage

$result = WC_Helper_API_Backoff::is_rate_limited( $request_type ): bool;
$request_type(string) (required)
The Helper API request type (e.g. 'update-check').

WC_Helper_API_Backoff::is_rate_limited() code WC 11.3.0

public static function is_rate_limited( string $request_type ): bool {
	if ( self::is_refresh_request() ) {
		self::clear( $request_type );
		return false;
	}

	$retry_after = get_transient( self::get_transient_key( $request_type ) );

	return is_numeric( $retry_after ) && (int) $retry_after > time();
}