delay in seconds). * * @return array */ public function getIntervals(): array { return apply_filters('oneclickformsync_retry_intervals', [ 1 => 20, // 20 seconds 2 => 300, // 5 minutes 3 => 900, // 15 minutes 4 => 3600, // 1 hour 5 => 21600, // 6 hours ]); } /** * Calculate the timestamp for the next retry attempt based on current attempt count. * * @param int $attempts Number of attempts already made. * @return int|null Next timestamp, or null if maximum retries exceeded. */ public function getNextAttemptTimestamp(int $attempts): ?int { $intervals = $this->getIntervals(); if ($attempts >= count($intervals)) { // Max attempts budget exhausted. return null; } $delay = $intervals[$attempts + 1] ?? 60; return current_time('timestamp', true) + $delay; } /** * Check if maximum attempts have been reached. * * @param int $attempts * @return bool */ public function isMaxAttemptsReached(int $attempts): bool { return $attempts >= count($this->getIntervals()); } }