WC_Helper_API_Backoff::is_rate_limited
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.
Метод класса: WC_Helper_API_Backoff{}
Хуков нет.
Возвращает
bool. True while the site should refrain from calling the endpoint.
Использование
$result = WC_Helper_API_Backoff::is_rate_limited( $request_type ): bool;
- $request_type(строка) (обязательный)
- The Helper API request type (e.g. 'update-check').
Код WC_Helper_API_Backoff::is_rate_limited() WC Helper API Backoff::is rate limited WC 11.2.2
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();
}