Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
namespace ServiceControl.Audit.Persistence.RavenDB
{
using System;
using Sparrow.Json;

public class DatabaseConfiguration(
string name,
Expand All @@ -20,8 +19,6 @@ public class DatabaseConfiguration(

public bool EnableFullTextSearch { get; } = enableFullTextSearch;

public Func<string, BlittableJsonReaderObject, string> FindClrType { get; }

public ServerConfiguration ServerConfiguration { get; } = serverConfiguration;

public TimeSpan AuditRetentionPeriod { get; } = auditRetentionPeriod;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,7 @@ public async Task Initialize(CancellationToken cancellationToken = default)

var serverConfig = databaseConfiguration.ServerConfiguration;

var embeddedConfig = new EmbeddedDatabaseConfiguration(serverConfig.ServerUrl, databaseConfiguration.Name, serverConfig.DbPath, serverConfig.LogPath, serverConfig.LogsMode)
{
FindClrType = databaseConfiguration.FindClrType
};
var embeddedConfig = new EmbeddedDatabaseConfiguration(serverConfig.ServerUrl, databaseConfiguration.Name, serverConfig.DbPath, serverConfig.LogPath, serverConfig.LogsMode);

database = EmbeddedDatabase.Start(embeddedConfig, lifetime);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,11 +46,6 @@ public async Task Initialize(CancellationToken cancellationToken = default)
}
};

if (configuration.FindClrType != null)
{
store.Conventions.FindClrType += configuration.FindClrType;
}

documentStore = store.Initialize();

await StartupChecks.EnsureServerVersion(store, cancellationToken);
Expand Down
5 changes: 0 additions & 5 deletions src/ServiceControl.RavenDB/EmbeddedDatabase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,6 @@ public async Task<IDocumentStore> Connect(CancellationToken cancellationToken)
SkipCreatingDatabase = true
};

if (configuration.FindClrType != null)
{
dbOptions.Conventions.FindClrType += configuration.FindClrType;
}

var store = await EmbeddedServer.Instance.GetDocumentStoreAsync(dbOptions, cancellationToken);
return store;
}
Expand Down
4 changes: 0 additions & 4 deletions src/ServiceControl.RavenDB/EmbeddedDatabaseConfiguration.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
namespace ServiceControl.RavenDB
{
using Sparrow.Json;

public class EmbeddedDatabaseConfiguration(string serverUrl, string dbName, string dbPath, string logPath, string logsMode)
{
public string Name { get; } = dbName;
Expand All @@ -11,7 +9,5 @@ public class EmbeddedDatabaseConfiguration(string serverUrl, string dbName, stri
public string LogsMode { get; } = logsMode;

public bool RunInMemory { get; set; }

public Func<string, BlittableJsonReaderObject, string> FindClrType { get; init; }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -54,12 +54,9 @@ public async Task RebuildRetryOperationState()

foreach (var group in stagingBatchGroups)
{
if (!string.IsNullOrWhiteSpace(group.RequestId))
{
logger.LogDebug("Rebuilt retry operation status for {RetryType}/{RetryRequestId}. Aggregated batchsize: {RetryBatchSize}", group.RetryType, group.RequestId, group.InitialBatchSize);
logger.LogDebug("Rebuilt retry operation status for {RetryType}/{RetryRequestId}. Aggregated batchsize: {RetryBatchSize}", group.RetryType, group.RequestId, group.InitialBatchSize);

await operationManager.PreparedAdoptedBatch(group.RequestId, group.RetryType, group.InitialBatchSize, group.InitialBatchSize, group.Originator, group.Classifier, group.StartTime, group.Last);
}
await operationManager.PreparedAdoptedBatch(group.RequestId, group.RetryType, group.InitialBatchSize, group.InitialBatchSize, group.Originator, group.Classifier, group.StartTime, group.Last);
}
}

Expand Down
42 changes: 2 additions & 40 deletions src/ServiceControl/Recoverability/Retrying/RetryingManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,6 @@ public RetryingManager(IDomainEvents domainEvents, ILogger<RetryingManager> logg

public Task Wait(string requestId, RetryType retryType, DateTime started, string originator = null, string classifier = null, DateTime? last = null)
{
if (requestId == null) //legacy support for batches created before operations were introduced
{
return Task.CompletedTask;
}

var summary = GetOrCreate(retryType, requestId);

return summary.Wait(started, originator, classifier, last);
Expand All @@ -45,23 +40,13 @@ public bool IsRetryInProgressFor(string requestId)

public async Task Preparing(string requestId, RetryType retryType, int totalNumberOfMessages)
{
if (requestId == null) //legacy support for batches created before operations were introduced
{
return;
}

var summary = GetOrCreate(retryType, requestId);

await summary.Prepare(totalNumberOfMessages);
}

public async Task PreparedAdoptedBatch(string requestId, RetryType retryType, int numberOfMessagesPrepared, int totalNumberOfMessages, string originator, string classifier, DateTime startTime, DateTime last)
{
if (requestId == null) //legacy support for batches created before operations were introduced
{
return;
}

var summary = GetOrCreate(retryType, requestId);

await summary.Prepare(totalNumberOfMessages);
Expand All @@ -70,65 +55,42 @@ public async Task PreparedAdoptedBatch(string requestId, RetryType retryType, in

public async Task PreparedBatch(string requestId, RetryType retryType, int numberOfMessagesPrepared)
{
if (requestId == null) //legacy support for batches created before operations were introduced
{
return;
}

var summary = GetOrCreate(retryType, requestId);

await summary.PrepareBatch(numberOfMessagesPrepared);
}

public async Task Forwarding(string requestId, RetryType retryType)
{
if (requestId == null) //legacy support for batches created before operations were introduced
{
return;
}

var summary = GetOrCreate(retryType, requestId);

await summary.Forwarding();
}

public async Task ForwardedBatch(string requestId, RetryType retryType, int numberOfMessagesForwarded)
{
if (requestId == null) //legacy support for batches created before operations were introduced
{
return;
}

var summary = GetOrCreate(retryType, requestId);

await summary.BatchForwarded(numberOfMessagesForwarded);
}

public void Fail(RetryType retryType, string requestId)
{
if (requestId == null) //legacy support for batches created before operations were introduced
{
return;
}

var summary = GetOrCreate(retryType, requestId);

summary.Fail();
}

public async Task Skip(string requestId, RetryType retryType, int numberOfMessagesSkipped)
{
if (requestId == null) //legacy support for batches created before operations were introduced
{
return;
}

var summary = GetOrCreate(retryType, requestId);
await summary.Skip(numberOfMessagesSkipped);
}

InMemoryRetry GetOrCreate(RetryType retryType, string requestId)
{
ArgumentException.ThrowIfNullOrWhiteSpace(requestId);

var key = InMemoryRetry.MakeOperationId(requestId, retryType);
return retryOperations.GetOrAdd(key, _ => new InMemoryRetry(requestId, retryType, domainEvents, logger));
}
Expand Down
Loading