WC_Helper_API_Backoff::get_retry_after
Seconds remaining in a request type's backoff window.
Lets callers align a user-facing message with the window the site is actually observing, so a rate-limit notice stays visible for exactly as long as requests are being suppressed.
Метод класса: WC_Helper_API_Backoff{}
Хуков нет.
Возвращает
int|null. Seconds until the window expires, or null when not rate limited.
Использование
$result = WC_Helper_API_Backoff::get_retry_after( $request_type ): ?int;
- $request_type(строка) (обязательный)
- The Helper API request type (e.g. 'update-check').
Список изменений
| С версии 11.2.0 | Введена. |
Код WC_Helper_API_Backoff::get_retry_after() WC Helper API Backoff::get retry after WC 11.2.2
public static function get_retry_after( string $request_type ): ?int {
$expires_at = get_transient( self::get_transient_key( $request_type ) );
if ( ! is_numeric( $expires_at ) ) {
return null;
}
$remaining = (int) $expires_at - time();
return $remaining > 0 ? $remaining : null;
}