a library to speed up the development of Fivem scripts and frameworks
fivem-ts - Documentation v0.7.5 • Docs
fivem-ts - Documentation v0.7.5 / Shared / Retry
Retry(
attempts
,delay
): (target
,propertyKey
,descriptor
) =>void
A decorator to automatically retry a method upon failure.
This decorator retries the decorated method a specified number of times, with a delay between each attempt. If all attempts fail, the last error will be thrown.
• attempts: number
The number of retry attempts before failing.
• delay: number
The delay in milliseconds between each retry attempt.
Function
A method decorator that applies the retry logic.
• target: object
• propertyKey: string
| symbol
• descriptor: TypedPropertyDescriptor
<Function
>
void
import { Retry } from 'fivem-ts/shared/decorators';
class MyService {
@Retry(3, 1000)
async unstableMethod(): Promise<void> {
// Some operation that might fail
}
}