Skip to content

Commit

Permalink
Added timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
Aragas committed Nov 25, 2023
1 parent 6589c62 commit bf0dfdc
Show file tree
Hide file tree
Showing 8 changed files with 25 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,9 @@ public AutocompleteProcessorProcessorJob(ILogger<AutocompleteProcessorProcessorJ

public async Task Execute(IJobExecutionContext context)
{
var ct = context.CancellationToken;
using var ctsTimeout = new CancellationTokenSource(TimeSpan.FromMinutes(10));
using var cts = CancellationTokenSource.CreateLinkedTokenSource(context.CancellationToken, ctsTimeout.Token);
var ct = cts.Token;

foreach (var tenant in TenantId.Values)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public CrashReportAnalyzerProcessorJob(ILogger<CrashReportAnalyzerProcessorJob>

public async Task Execute(IJobExecutionContext context)
{
var ct = context.CancellationToken;
using var ctsTimeout = new CancellationTokenSource(TimeSpan.FromMinutes(10));
using var cts = CancellationTokenSource.CreateLinkedTokenSource(context.CancellationToken, ctsTimeout.Token);
var ct = cts.Token;

foreach (var tenant in TenantId.Values)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@

using System;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;

namespace BUTR.Site.NexusMods.Server.Jobs;
Expand All @@ -28,7 +29,9 @@ public CrashReportProcessorJob(ILogger<CrashReportProcessorJob> logger, IService

public async Task Execute(IJobExecutionContext context)
{
var ct = context.CancellationToken;
using var ctsTimeout = new CancellationTokenSource(TimeSpan.FromMinutes(10));
using var cts = CancellationTokenSource.CreateLinkedTokenSource(context.CancellationToken, ctsTimeout.Token);
var ct = cts.Token;

var processed = 0;
foreach (var tenant in TenantId.Values)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public NexusModsArticleProcessorJob(ILogger<NexusModsArticleProcessorJob> logger

public async Task Execute(IJobExecutionContext context)
{
var ct = context.CancellationToken;
using var ctsTimeout = new CancellationTokenSource(TimeSpan.FromMinutes(30));
using var cts = CancellationTokenSource.CreateLinkedTokenSource(context.CancellationToken, ctsTimeout.Token);
var ct = cts.Token;

foreach (var tenant in TenantId.Values)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,9 @@ public NexusModsArticleUpdatesProcessorJob(ILogger<NexusModsArticleUpdatesProces

public async Task Execute(IJobExecutionContext context)
{
var ct = context.CancellationToken;
using var ctsTimeout = new CancellationTokenSource(TimeSpan.FromMinutes(30));
using var cts = CancellationTokenSource.CreateLinkedTokenSource(context.CancellationToken, ctsTimeout.Token);
var ct = cts.Token;

var processed = 0;
foreach (var tenant in TenantId.Values)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,9 @@ public NexusModsModFileProcessorJob(ILogger<NexusModsModFileProcessorJob> logger

public async Task Execute(IJobExecutionContext context)
{
var ct = context.CancellationToken;
using var ctsTimeout = new CancellationTokenSource(TimeSpan.FromDays(1));
using var cts = CancellationTokenSource.CreateLinkedTokenSource(context.CancellationToken, ctsTimeout.Token);
var ct = cts.Token;

var processed = 0;
var exceptions = new List<Exception>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,9 @@ public NexusModsModFileUpdatesProcessorJob(ILogger<NexusModsModFileUpdatesProces

public async Task Execute(IJobExecutionContext context)
{
var ct = context.CancellationToken;
using var ctsTimeout = new CancellationTokenSource(TimeSpan.FromHours(6));
using var cts = CancellationTokenSource.CreateLinkedTokenSource(context.CancellationToken, ctsTimeout.Token);
var ct = cts.Token;

var processed = 0;
var exceptions = new List<Exception>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,9 @@ public TopExceptionsTypesAnalyzerProcessorJob(ILogger<TopExceptionsTypesAnalyzer

public async Task Execute(IJobExecutionContext context)
{
var ct = context.CancellationToken;
using var ctsTimeout = new CancellationTokenSource(TimeSpan.FromMinutes(10));
using var cts = CancellationTokenSource.CreateLinkedTokenSource(context.CancellationToken, ctsTimeout.Token);
var ct = cts.Token;

foreach (var tenant in TenantId.Values)
{
Expand Down

0 comments on commit bf0dfdc

Please sign in to comment.