fix: log
This commit is contained in:
@@ -184,6 +184,36 @@ class TelegramNotifier
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Timeouts, transport errors, 429 and 5xx are worth another queue attempt.
|
||||
* Chat-not-found / kicked / unauthorized are permanent.
|
||||
*/
|
||||
public static function isRetryableSendError(?string $error): bool
|
||||
{
|
||||
$error = trim((string) $error);
|
||||
if ($error === '') {
|
||||
return true;
|
||||
}
|
||||
|
||||
$e = strtolower($error);
|
||||
if (str_contains($e, 'too many requests') || str_contains($e, 'retry after') || str_contains($e, '429')) {
|
||||
return true;
|
||||
}
|
||||
if (preg_match('/\bhttp\s*5\d\d\b/', $e) === 1) {
|
||||
return true;
|
||||
}
|
||||
if (str_contains($e, 'curl error')
|
||||
|| str_contains($e, 'timed out')
|
||||
|| str_contains($e, 'timeout')
|
||||
|| str_contains($e, 'connection')
|
||||
|| str_contains($e, 'resolve host')
|
||||
|| str_contains($e, 'ssl')) {
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return array{ok: bool, error: ?string}
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user