WIP: p2 plugin
Some checks failed
Build Docker Images / test (map[name:Morska plugin_project:DiunaBI.Plugins.Morska]) (push) Failing after 1m14s
Build Docker Images / test (map[name:PedrolloPL plugin_project:DiunaBI.Plugins.PedrolloPL]) (push) Failing after 1m10s
Build Docker Images / build-and-push (map[image_suffix:morska name:Morska plugin_project:DiunaBI.Plugins.Morska]) (push) Failing after 1m12s
Build Docker Images / build-and-push (map[image_suffix:pedrollopl name:PedrolloPL plugin_project:DiunaBI.Plugins.PedrolloPL]) (push) Failing after 1m7s

This commit is contained in:
2025-12-03 13:33:38 +01:00
parent 445c07a8d8
commit 0e3b3933f0
16 changed files with 1302 additions and 32 deletions

View File

@@ -142,8 +142,16 @@ public class JobWorkerService : BackgroundService
else
{
job.Status = JobStatus.Retrying;
_logger.LogInformation("JobWorker: Job {JobId} will retry (attempt {RetryCount}/{MaxRetries})",
job.Id, job.RetryCount, job.MaxRetries);
// Exponential backoff: wait before retrying based on attempt number
var backoffDelay = GetBackoffDelay(job.RetryCount);
_logger.LogInformation("JobWorker: Job {JobId} will retry in {Delay} (attempt {RetryCount}/{MaxRetries})",
job.Id, backoffDelay, job.RetryCount, job.MaxRetries);
// Wait before marking as pending again
await Task.Delay(backoffDelay, stoppingToken);
job.Status = JobStatus.Pending;
}
}
finally
@@ -157,4 +165,14 @@ public class JobWorkerService : BackgroundService
_logger.LogInformation("JobWorker: Stopping service...");
await base.StopAsync(stoppingToken);
}
private static TimeSpan GetBackoffDelay(int retryCount)
{
return retryCount switch
{
1 => TimeSpan.FromSeconds(30), // 1st retry: 30 seconds
2 => TimeSpan.FromMinutes(2), // 2nd retry: 2 minutes
_ => TimeSpan.FromMinutes(5) // 3rd+ retry: 5 minutes
};
}
}