static void RunExpiry(EmbeddableDocumentStore documentStore, DateTime expiryThreshold) { new ExpirySagaAuditIndex().Execute(documentStore); documentStore.WaitForIndexing(); SagaHistoryCleaner.Clean(100, documentStore.DocumentDatabase, expiryThreshold); documentStore.WaitForIndexing(); }
public static Task <TimerJobExecutionResult> RunCleanup(int deletionBatchSize, DocumentDatabase database, Settings settings, CancellationToken token) { var threshold = SystemTime.UtcNow.Add(-settings.AuditRetentionPeriod); logger.Debug("Trying to find expired ProcessedMessage, SagaHistory and KnownEndpoint documents to delete (with threshold {0})", threshold.ToString(Default.DateTimeFormatsToWrite, CultureInfo.InvariantCulture)); AuditMessageCleaner.Clean(deletionBatchSize, database, threshold, token); KnownEndpointsCleaner.Clean(deletionBatchSize, database, threshold, token); SagaHistoryCleaner.Clean(deletionBatchSize, database, threshold, token); return(Task.FromResult(TimerJobExecutionResult.ScheduleNextExecution)); }