potentially fix stuck uploads
This commit is contained in:
@@ -59,6 +59,8 @@ public class FileCleanupService : IHostedService
|
||||
|
||||
if (_isMainServer)
|
||||
{
|
||||
CleanUpStuckUploads(dbContext);
|
||||
|
||||
await dbContext.SaveChangesAsync(ct).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
@@ -72,6 +74,12 @@ public class FileCleanupService : IHostedService
|
||||
}
|
||||
}
|
||||
|
||||
private void CleanUpStuckUploads(MareDbContext dbContext)
|
||||
{
|
||||
var stuckUploads = dbContext.Files.Where(f => !f.Uploaded && f.UploadDate < DateTime.UtcNow.Subtract(TimeSpan.FromMinutes(10)));
|
||||
dbContext.Files.RemoveRange(stuckUploads);
|
||||
}
|
||||
|
||||
private void CleanUpFilesBeyondSizeLimit(MareDbContext dbContext, CancellationToken ct)
|
||||
{
|
||||
var sizeLimit = _configuration.GetValueOrDefault<double>(nameof(StaticFilesServerConfiguration.CacheSizeHardLimitInGiB), -1);
|
||||
|
||||
Reference in New Issue
Block a user