mirror of https://github.com/Squidex/squidex.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
40 lines
1.2 KiB
40 lines
1.2 KiB
// ==========================================================================
|
|
// Squidex Headless CMS
|
|
// ==========================================================================
|
|
// Copyright (c) Squidex UG (haftungsbeschraenkt)
|
|
// All rights reserved. Licensed under the MIT license.
|
|
// ==========================================================================
|
|
|
|
using Orleans;
|
|
using Orleans.Runtime;
|
|
using tusdotnet.Interfaces;
|
|
|
|
namespace Squidex.Domain.Apps.Entities.Assets
|
|
{
|
|
public sealed class AssetCleanupGrain : Grain, IRemindable, IAssetCleanupGrain
|
|
{
|
|
private readonly ITusExpirationStore expirationStore;
|
|
|
|
public AssetCleanupGrain(ITusExpirationStore expirationStore)
|
|
{
|
|
this.expirationStore = expirationStore;
|
|
}
|
|
|
|
public override Task OnActivateAsync()
|
|
{
|
|
RegisterOrUpdateReminder("Cleanup", TimeSpan.Zero, TimeSpan.FromMinutes(10));
|
|
|
|
return base.OnActivateAsync();
|
|
}
|
|
|
|
public Task ActivateAsync()
|
|
{
|
|
return Task.CompletedTask;
|
|
}
|
|
|
|
public Task ReceiveReminder(string reminderName, TickStatus status)
|
|
{
|
|
return expirationStore.RemoveExpiredFilesAsync(default);
|
|
}
|
|
}
|
|
}
|
|
|