[backend/queue] Improve inbox queue retry mechanism (ISH-503)

This retries jobs for a cumulative maximum of 24 hours.
This commit is contained in:
Laura Hausmann 2024-09-26 20:43:45 +02:00
parent 9f39895142
commit 36f277e0d3
No known key found for this signature in database
GPG key ID: D044E84C5BE01605

View file

@ -41,11 +41,11 @@ public class InboxQueue(int parallelism)
}
catch (Exception e) when (e is not GracefulException)
{
if (job.RetryCount++ < 4)
if (job.RetryCount++ < 10)
{
var jitter = TimeSpan.FromSeconds(new Random().Next(0, 60));
var baseDelay = TimeSpan.FromMinutes(1);
var maxBackoff = TimeSpan.FromHours(8);
var maxBackoff = TimeSpan.FromHours(7);
var backoff = (Math.Pow(2, job.RetryCount) - 1) * baseDelay;
if (backoff > maxBackoff)
backoff = maxBackoff;