AutoRetryOptions
Options that can be specified when creating an auto retry transformer function.
Properties
maxDelaySeconds
maxDelaySeconds: number;
Determines the maximum number of seconds that should be regarded from the retry
parameter. If the retry
value exceeds this threshold, the error will be passed on, hence failing the request. For instance, this is useful if you don’t want your bot to retry sending messages that are too old.
The default value is Infinity
. This means that the threshold is disabled. The plugin will wait any number of seconds.
maxRetryAttempts
maxRetryAttempts: number;
Determines the maximum number of times that an API request should be retried. If the request has been retried the specified number of times but still fails, the error will be rethrown, eventually failing the request.
The default value is Infinity
. This means that the threshold is disabled. The plugin will attempt to retry requests indefinitely.
rethrowInternalServerErrors
rethrowInternalServerErrors: boolean;
Requests to the Telegram servers can sometimes encounter internal server errors (error with status code >= 500). Those are usually not something you can fix in your code. They often are temporary issues, but even if they persist, they require a fix by the web server or any potential proxies. It is therefore the best strategy to retry such errors automatically, which is what this plugin does by default.
Set this option to true
if the plugin should rethrow internal server errors rather than retrying the respective requests automatically.
(https://
rethrowHttpErrors
rethrowHttpErrors: boolean;
Network requests can sometimes fail, especially when the network connection is flaky or unstable, or when intermediate hops are rebooting or are unreliable. When a network request fails in this way, grammY throws an Http
. If these errors only happen occasionally, it is usually not something that you can fix in your code. It is therefore the best strategy to retry such errors automatically, which is what this plugin does by default.
Set this option to true
if the plugin should rethrow networking errors (Http
instances) rather than retrying the respective requests automatically.