Beispiel #1
0
 static Cleaner CreateCleaner(IPersister persister, IBuilder builder)
 {
     return(new Cleaner(token =>
     {
         persister.CleanupItemsOlderThan(DateTime.UtcNow, token);
         return Task.CompletedTask;
     },
                        criticalError: builder.Build <CriticalError>().Raise,
                        frequencyToRunCleanup: TimeSpan.FromHours(1),
                        timer: new AsyncTimer()));
 }
Beispiel #2
0
 static Cleaner CreateCleaner(AttachmentSettings settings, IPersister persister, IBuilder builder)
 {
     return(new Cleaner(async token =>
     {
         using (var connection = await settings.ConnectionFactory().ConfigureAwait(false))
         {
             await persister.CleanupItemsOlderThan(connection, null, DateTime.UtcNow, token).ConfigureAwait(false);
         }
     },
                        criticalError: builder.Build <CriticalError>().Raise,
                        frequencyToRunCleanup: TimeSpan.FromHours(1),
                        timer: new AsyncTimer()));
 }