Skip to content

Commit

Permalink
Merge pull request #350 from bcgov/yj
Browse files Browse the repository at this point in the history
Yj
  • Loading branch information
ychung-mot authored May 31, 2024
2 parents 6dc4c0d + b7044c5 commit 75b044d
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
4 changes: 2 additions & 2 deletions helm/main/values-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ hangfire:

resources:
limits:
cpu: 300m
cpu: 400m
memory: 600Mi
requests:
cpu: 150m
cpu: 200m
memory: 400Mi

env:
Expand Down
4 changes: 2 additions & 2 deletions helm/main/values-uat.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -94,10 +94,10 @@ hangfire:

resources:
limits:
cpu: 300m
cpu: 400m
memory: 600Mi
requests:
cpu: 150m
cpu: 200m
memory: 400Mi

env:
Expand Down
3 changes: 2 additions & 1 deletion server/StrDss.Service/Hangfire/SkipSameJobAttribute.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,13 @@ public void OnCreating(CreatingContext context)
//delete stalled jobs
var monitor = context.Storage.GetMonitoringApi();
var allJobs = monitor.ProcessingJobs(0, 999999999);
var cutoffTime = DateTime.UtcNow.AddMinutes(-10);
var cutoffTime = DateTime.UtcNow.AddHours(-12);

foreach (var processingJob in allJobs)
{
if (processingJob.Value.StartedAt < cutoffTime)
{
Console.WriteLine($"[Hangfire] Deleting stalled job: {processingJob.Key} {processingJob.Value.InProcessingState} ");
BackgroundJob.Delete(processingJob.Key);
}
}
Expand Down

0 comments on commit 75b044d

Please sign in to comment.