Retry delay
jnordberg opened this issue · 8 comments
Would be nice to be able to be able to specify a delay between retries.
Maybe something like
protocol Job {
func nextRetry(attempt: Int) -> Date
}
extension Job {
func nextRetry(attempt: Int) -> Date { return Date() }
}
That would allow you to implement exponential backoff etc
Agreed, this is a good idea. Unfortunately this would be a break change (unless we can find a different way to accomplish it) so would need to wait for Queues v2.
Wouldn't the default implementation in the protocol make it backwards compatible? 🤔
@tanner0101 would need to weigh in here but I'm pretty sure any public protocol addition regardless of default implementation is semvar major
@jdmcd if it has a default impl that's fine for semver minor. (By Vapor's semver rules at least--other projects might be more strict)
Oh fantastic! In this case then I think it'd be a great addition.
I just had a dream about this kinda feature for queues haha. I think it'd be super helpful as well like an exponential back off sort of retry. Similar to how stripe retries failed webhooks
Totally agreed, I think this would be great! Unfortunately I don't have a ton of bandwidth to implement it myself but if anyone else wants to I'm more than happy to provide guidance + reviews!