Open matheus-rodrigues00 opened 1 year ago
I felt that my understanding of Promise improved in the previous issue.
I think this issue is also related, so can I be greedy about the issue?
@ahn0min go ahead! 🚀
@matheus-rodrigues00 I ran into a problem.
I wonder what the criteria for success should be. If it resolves after the interval time, is this a success?
If so, shouldn't there be a not retry after that? And if I retry up to 3 times, should Promises 1 and 2 be canceled instead of running in the background?
@ahn0min
I think you should run the Promise until it rejects. When it does reject you should run the promise over again after sleep
the retry_interval_ms
.
The criteria for success: The promise resolves, no matter the interval.
You shouldn't worry about cancelling Promises on background, because there will be none, since you will only jump to the next Promise call after the currently rejects.
Anyway, this idea is not written in stone, use your best judgment.
Implement a retry method that executes a promise-returning function repeatedly until it succeeds or reaches a maximum number of retries. Also allows specifying the interval between retry attempts. Example Usage: