diff --git a/src/Custom.Build.props b/src/Custom.Build.props
index bd7a33fe62..95d40240c9 100644
--- a/src/Custom.Build.props
+++ b/src/Custom.Build.props
@@ -24,4 +24,9 @@
+
+
+ false
+
+
diff --git a/src/Directory.Packages.props b/src/Directory.Packages.props
index 5b504a3559..d8b67e2cbc 100644
--- a/src/Directory.Packages.props
+++ b/src/Directory.Packages.props
@@ -63,7 +63,7 @@
-
+
@@ -93,7 +93,7 @@
-
+
diff --git a/src/ServiceControl.Audit.Persistence.RavenDb5/UnitOfWork/RavenDbAuditIngestionUnitOfWork.cs b/src/ServiceControl.Audit.Persistence.RavenDb5/UnitOfWork/RavenDbAuditIngestionUnitOfWork.cs
index 39f7382a01..135aec4b36 100644
--- a/src/ServiceControl.Audit.Persistence.RavenDb5/UnitOfWork/RavenDbAuditIngestionUnitOfWork.cs
+++ b/src/ServiceControl.Audit.Persistence.RavenDb5/UnitOfWork/RavenDbAuditIngestionUnitOfWork.cs
@@ -1,6 +1,7 @@
namespace ServiceControl.Audit.Persistence.RavenDb.UnitOfWork
{
using System;
+ using System.Threading;
using System.Threading.Tasks;
using Auditing;
using Auditing.BodyStorage;
@@ -16,12 +17,14 @@
class RavenDbAuditIngestionUnitOfWork : IAuditIngestionUnitOfWork
{
BulkInsertOperation bulkInsert;
+ CancellationTokenSource timedCancellationSource;
TimeSpan auditRetentionPeriod;
IBodyStorage bodyStorage;
- public RavenDbAuditIngestionUnitOfWork(BulkInsertOperation bulkInsert, TimeSpan auditRetentionPeriod, IBodyStorage bodyStorage)
+ public RavenDbAuditIngestionUnitOfWork(BulkInsertOperation bulkInsert, CancellationTokenSource timedCancellationSource, TimeSpan auditRetentionPeriod, IBodyStorage bodyStorage)
{
this.bulkInsert = bulkInsert;
+ this.timedCancellationSource = timedCancellationSource;
this.auditRetentionPeriod = auditRetentionPeriod;
this.bodyStorage = bodyStorage;
}
@@ -70,6 +73,9 @@ public Task RecordKnownEndpoint(KnownEndpoint knownEndpoint)
=> bulkInsert.StoreAsync(knownEndpoint, GetExpirationMetadata());
public async ValueTask DisposeAsync()
- => await bulkInsert.DisposeAsync().ConfigureAwait(false);
+ {
+ await bulkInsert.DisposeAsync().ConfigureAwait(false);
+ timedCancellationSource.Dispose();
+ }
}
}
\ No newline at end of file
diff --git a/src/ServiceControl.Audit.Persistence.RavenDb5/UnitOfWork/RavenDbAuditUnitOfWorkFactory.cs b/src/ServiceControl.Audit.Persistence.RavenDb5/UnitOfWork/RavenDbAuditUnitOfWorkFactory.cs
index 551048aae2..654a1112b8 100644
--- a/src/ServiceControl.Audit.Persistence.RavenDb5/UnitOfWork/RavenDbAuditUnitOfWorkFactory.cs
+++ b/src/ServiceControl.Audit.Persistence.RavenDb5/UnitOfWork/RavenDbAuditUnitOfWorkFactory.cs
@@ -1,5 +1,7 @@
namespace ServiceControl.Audit.Persistence.RavenDb.UnitOfWork
{
+ using System;
+ using System.Threading;
using Persistence.UnitOfWork;
using Raven.Client.Documents.BulkInsert;
using RavenDb;
@@ -18,12 +20,12 @@ public RavenDbAuditIngestionUnitOfWorkFactory(IRavenDbDocumentStoreProvider docu
public IAuditIngestionUnitOfWork StartNew(int batchSize)
{
+ var timedCancellationSource = new CancellationTokenSource(TimeSpan.FromMinutes(1));
var bulkInsert = documentStoreProvider.GetDocumentStore()
- .BulkInsert(
- options: new BulkInsertOptions { SkipOverwriteIfUnchanged = true, });
+ .BulkInsert(new BulkInsertOptions { SkipOverwriteIfUnchanged = true, }, timedCancellationSource.Token);
return new RavenDbAuditIngestionUnitOfWork(
- bulkInsert, databaseConfiguration.AuditRetentionPeriod, new RavenAttachmentsBodyStorage(sessionProvider, bulkInsert, databaseConfiguration.MaxBodySizeToStore)
+ bulkInsert, timedCancellationSource, databaseConfiguration.AuditRetentionPeriod, new RavenAttachmentsBodyStorage(sessionProvider, bulkInsert, databaseConfiguration.MaxBodySizeToStore)
);
}
diff --git a/src/Setup/ServiceControl.aip b/src/Setup/ServiceControl.aip
index e053de7be9..49d0da793a 100644
--- a/src/Setup/ServiceControl.aip
+++ b/src/Setup/ServiceControl.aip
@@ -628,15 +628,15 @@
-
-
+
+
-
-
+
+