Skip to content

Commit

Permalink
add removing from tracker service to background file service
Browse files Browse the repository at this point in the history
  • Loading branch information
radek00 committed Feb 24, 2024
1 parent ebf5e1b commit 16fe830
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
using var scope = _serviceProvider.CreateScope();
await RemoveFailedUploads(scope, stoppingToken);
await Task.Delay(TimeSpan.FromMinutes(2), stoppingToken);
await Task.Delay(TimeSpan.FromMinutes(30), stoppingToken);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ private async Task RemoveExpiredUploads(CancellationToken token)
var query = dbContext.SecureSendUploads.Where(u => u.ExpiryDate < DateTime.UtcNow);
var expiredUploads = await query.AsNoTracking().ToListAsync(token);

var trackerService = scope.ServiceProvider.GetRequiredService<IUploadSizeTrackerService>();
foreach (var upload in expiredUploads)
{
fileService.RemoveUpload(upload.Id);
trackerService.Remove(upload.Id);
_logger.LogInformation("Removing expired upload: {@id}", upload.Id);
}

Expand Down

0 comments on commit 16fe830

Please sign in to comment.