*/ public function backoff(): array { return [10, 60, 300]; } public function handle(TelegramNotifier $telegram): void { $result = $telegram->sendToChat($this->chatId, $this->text, $this->token); if ($result['ok']) { return; } $error = (string) ($result['error'] ?? 'unknown'); SafeLog::channel('telegram')->warning('SendTelegramMessage job failed', [ 'chat_id' => $this->chatId, 'error' => $error, 'text_preview' => mb_substr($this->text, 0, 80), 'retryable' => TelegramNotifier::isRetryableSendError($error), ]); if (TelegramNotifier::isRetryableSendError($error)) { throw new RuntimeException('telegram send failed: '.$error); } } public function failed(?Throwable $e): void { SafeLog::channel('telegram')->error('SendTelegramMessage given up after retries', [ 'chat_id' => $this->chatId, 'error' => $e?->getMessage(), 'text_preview' => mb_substr($this->text, 0, 80), ]); } }