Formatting

This commit is contained in:
2026-07-05 16:04:53 +02:00
parent b1010b0bb5
commit a37dcc1b45
9 changed files with 22 additions and 22 deletions
@@ -36,7 +36,7 @@ public sealed class OpenApiOptionsSetup(IOptions<AuthenticationConfiguration> op
}; };
return Task.CompletedTask; return Task.CompletedTask;
}); } );
options.AddOperationTransformer((operation, context, _) => options.AddOperationTransformer((operation, context, _) =>
{ {
@@ -58,9 +58,9 @@ public sealed class OpenApiOptionsSetup(IOptions<AuthenticationConfiguration> op
{ {
[new OpenApiSecuritySchemeReference(SecuritySchemeId, context.Document)] = [new OpenApiSecuritySchemeReference(SecuritySchemeId, context.Document)] =
_configuration.Scopes.ToList(), _configuration.Scopes.ToList(),
}); } );
return Task.CompletedTask; return Task.CompletedTask;
}); } );
} }
} }
@@ -84,7 +84,7 @@ namespace Musify.Application.PlayLists
await database.SaveChangesAsync(cancellationToken); await database.SaveChangesAsync(cancellationToken);
await transaction.CommitAsync(cancellationToken); await transaction.CommitAsync(cancellationToken);
logger.LogInformation("Issued upload intent {IntentId} for user {UserId} (PlayListPicture, temp key: {Key})", intent.Id, request.UserId, tempKey); logger.LogInformation("Issued upload intent {IntentId} for user {UserId} (PlayListPicture, temp key: {Key} )", intent.Id, request.UserId, tempKey);
return new PlayListPictureUploadResponse( return new PlayListPictureUploadResponse(
intent.Id, intent.Id,
@@ -24,7 +24,7 @@ namespace Musify.Application.Tracks
{ {
var track = await database.Tracks.AsNoTracking() var track = await database.Tracks.AsNoTracking()
.Where(t => t.Id == request.TrackId) .Where(t => t.Id == request.TrackId)
.Select(t => new { t.Id, t.AudioTranscodeProcessingStatus, t.AudioFolderName }) .Select(t => new { t.Id, t.AudioTranscodeProcessingStatus, t.AudioFolderName } )
.SingleOrDefaultAsync(cancellationToken); .SingleOrDefaultAsync(cancellationToken);
if (track is null) if (track is null)
@@ -15,7 +15,7 @@ namespace Musify.Infrastructure.Jobs
{ {
protected override async Task ExecuteAsync(CancellationToken stoppingToken) protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{ {
logger.LogInformation("TemporalUploadsCleanUpJob started (interval: {Interval}s, prefix: {Prefix})", logger.LogInformation("TemporalUploadsCleanUpJob started (interval: {Interval}s, prefix: {Prefix} )",
uploadIntentConfiguration.TemporalCleanUpJobIntervalSeconds, uploadIntentConfiguration.TemporalCleanUpJobIntervalSeconds,
uploadIntentConfiguration.TemporalRootPrefix); uploadIntentConfiguration.TemporalRootPrefix);
@@ -27,7 +27,7 @@ namespace Musify.Infrastructure.MassTransit
outbox.QueryDelay = TimeSpan.FromSeconds(1); outbox.QueryDelay = TimeSpan.FromSeconds(1);
outbox.DuplicateDetectionWindow = TimeSpan.FromMinutes(30); outbox.DuplicateDetectionWindow = TimeSpan.FromMinutes(30);
}); } );
options.UsingRabbitMq((busRegistrationContext, busFactoryConfigurator) => options.UsingRabbitMq((busRegistrationContext, busFactoryConfigurator) =>
ConfigureRabbitMqHost( ConfigureRabbitMqHost(
@@ -61,7 +61,7 @@ namespace Musify.Infrastructure.MassTransit
outbox.QueryDelay = TimeSpan.FromSeconds(1); outbox.QueryDelay = TimeSpan.FromSeconds(1);
outbox.DuplicateDetectionWindow = TimeSpan.FromMinutes(30); outbox.DuplicateDetectionWindow = TimeSpan.FromMinutes(30);
}); } );
options.SetKebabCaseEndpointNameFormatter(); options.SetKebabCaseEndpointNameFormatter();
@@ -73,7 +73,7 @@ namespace Musify.Infrastructure.MassTransit
repository.ConcurrencyMode = ConcurrencyMode.Pessimistic; repository.ConcurrencyMode = ConcurrencyMode.Pessimistic;
repository.ExistingDbContext<Database>(); repository.ExistingDbContext<Database>();
repository.UsePostgres(); repository.UsePostgres();
}); } );
options.AddSagaStateMachine<PlayListProcessingStateMachine, PlayListProcessingState>() options.AddSagaStateMachine<PlayListProcessingStateMachine, PlayListProcessingState>()
.EntityFrameworkRepository(repository => .EntityFrameworkRepository(repository =>
@@ -81,13 +81,13 @@ namespace Musify.Infrastructure.MassTransit
repository.ConcurrencyMode = ConcurrencyMode.Pessimistic; repository.ConcurrencyMode = ConcurrencyMode.Pessimistic;
repository.ExistingDbContext<Database>(); repository.ExistingDbContext<Database>();
repository.UsePostgres(); repository.UsePostgres();
}); } );
options.AddConfigureEndpointsCallback((registrationContext, _, endpointConfigurator) => options.AddConfigureEndpointsCallback((registrationContext, _, endpointConfigurator) =>
{ {
UseStandardRetry(endpointConfigurator); UseStandardRetry(endpointConfigurator);
endpointConfigurator.UseEntityFrameworkOutbox<Database>(registrationContext); endpointConfigurator.UseEntityFrameworkOutbox<Database>(registrationContext);
}); } );
options.UsingRabbitMq((busRegistrationContext, busFactoryConfigurator) => options.UsingRabbitMq((busRegistrationContext, busFactoryConfigurator) =>
{ {
@@ -96,7 +96,7 @@ namespace Musify.Infrastructure.MassTransit
busRegistrationContext.GetRequiredService<MassTransitConfiguration>()); busRegistrationContext.GetRequiredService<MassTransitConfiguration>());
busFactoryConfigurator.ConfigureEndpoints(busRegistrationContext); busFactoryConfigurator.ConfigureEndpoints(busRegistrationContext);
}); } );
} ); } );
return serviceDescriptors; return serviceDescriptors;
@@ -28,7 +28,7 @@ namespace Musify.Infrastructure.MassTransit.Sagas
context.Saga.UpdatedAt = DateTime.UtcNow; context.Saga.UpdatedAt = DateTime.UtcNow;
context.Saga.Bucket = context.Message.Bucket; context.Saga.Bucket = context.Message.Bucket;
context.Saga.PictureKey = context.Message.PictureDestinationKey; context.Saga.PictureKey = context.Message.PictureDestinationKey;
}) } )
.TransitionTo(Processing)); .TransitionTo(Processing));
During(Processing, During(Processing,
@@ -33,7 +33,7 @@ namespace Musify.Infrastructure.MassTransit.Sagas
context.Saga.Bucket = context.Message.Bucket; context.Saga.Bucket = context.Message.Bucket;
context.Saga.PictureKey = context.Message.PictureDestinationKey; context.Saga.PictureKey = context.Message.PictureDestinationKey;
context.Saga.AudioKey = context.Message.AudioDestinationKey; context.Saga.AudioKey = context.Message.AudioDestinationKey;
}) } )
.TransitionTo(Processing)); .TransitionTo(Processing));
During(Processing, During(Processing,
@@ -42,14 +42,14 @@ namespace Musify.Infrastructure.MassTransit.Sagas
{ {
context.Saga.PictureProcessed = true; context.Saga.PictureProcessed = true;
context.Saga.UpdatedAt = DateTime.UtcNow; context.Saga.UpdatedAt = DateTime.UtcNow;
}) } )
.If(context => context.Saga.AudioProcessed, binder => binder.Finalize()), .If(context => context.Saga.AudioProcessed, binder => binder.Finalize()),
When(AudioProcessed) When(AudioProcessed)
.Then(context => .Then(context =>
{ {
context.Saga.AudioProcessed = true; context.Saga.AudioProcessed = true;
context.Saga.UpdatedAt = DateTime.UtcNow; context.Saga.UpdatedAt = DateTime.UtcNow;
}) } )
.If(context => context.Saga.PictureProcessed, binder => binder.Finalize()), .If(context => context.Saga.PictureProcessed, binder => binder.Finalize()),
When(PictureFailed) When(PictureFailed)
.Then(context => context.Saga.UpdatedAt = DateTime.UtcNow) .Then(context => context.Saga.UpdatedAt = DateTime.UtcNow)
@@ -101,7 +101,7 @@ namespace Musify.Infrastructure.Services
using var process = BuildProcess(arguments, workingDirectory, redirectStandardInput: true); using var process = BuildProcess(arguments, workingDirectory, redirectStandardInput: true);
process.Start(); process.Start();
logger.LogDebug("[{Operation}] ffmpeg started (PID: {ProcessId}) in {WorkingDirectory}", operationName, process.Id, workingDirectory); logger.LogDebug("[{Operation}] ffmpeg started (PID: {ProcessId} ) in {WorkingDirectory}", operationName, process.Id, workingDirectory);
var outputTask = process.StandardOutput.ReadToEndAsync(cancellationToken); var outputTask = process.StandardOutput.ReadToEndAsync(cancellationToken);
var errorTask = process.StandardError.ReadToEndAsync(cancellationToken); var errorTask = process.StandardError.ReadToEndAsync(cancellationToken);
@@ -124,7 +124,7 @@ namespace Musify.Infrastructure.Services
using var process = BuildProcess(arguments, workingDirectory, redirectStandardInput: false); using var process = BuildProcess(arguments, workingDirectory, redirectStandardInput: false);
process.Start(); process.Start();
logger.LogDebug("[{Operation}] ffmpeg started (PID: {ProcessId}) in {WorkingDirectory}", operationName, process.Id, workingDirectory); logger.LogDebug("[{Operation}] ffmpeg started (PID: {ProcessId} ) in {WorkingDirectory}", operationName, process.Id, workingDirectory);
var outputTask = process.StandardOutput.ReadToEndAsync(cancellationToken); var outputTask = process.StandardOutput.ReadToEndAsync(cancellationToken);
var errorTask = process.StandardError.ReadToEndAsync(cancellationToken); var errorTask = process.StandardError.ReadToEndAsync(cancellationToken);
@@ -164,7 +164,7 @@ namespace Musify.Infrastructure.Services
} }
catch (OperationCanceledException) when (!cancellationToken.IsCancellationRequested) catch (OperationCanceledException) when (!cancellationToken.IsCancellationRequested)
{ {
logger.LogError("[{Operation}] ffmpeg timed out after {Timeout} (PID: {ProcessId})", logger.LogError("[{Operation}] ffmpeg timed out after {Timeout} (PID: {ProcessId} )",
operationName, audioTranscoderConfiguration.TranscodingTimeout, process.Id); operationName, audioTranscoderConfiguration.TranscodingTimeout, process.Id);
TryKillProcess(process); TryKillProcess(process);
@@ -174,7 +174,7 @@ namespace Musify.Infrastructure.Services
var standardError = await errorTask; var standardError = await errorTask;
var standardOutput = await outputTask; var standardOutput = await outputTask;
logger.LogDebug("[{Operation}] ffmpeg finished (PID: {ProcessId}). Exit code: {ExitCode}, Output: {OutputLength}B, Error: {ErrorLength}B", logger.LogDebug("[{Operation}] ffmpeg finished (PID: {ProcessId} ). Exit code: {ExitCode}, Output: {OutputLength}B, Error: {ErrorLength}B",
operationName, process.Id, process.ExitCode, standardOutput.Length, standardError.Length); operationName, process.Id, process.ExitCode, standardOutput.Length, standardError.Length);
return new FfmpegExecutionResult(process.ExitCode, standardOutput, standardError); return new FfmpegExecutionResult(process.ExitCode, standardOutput, standardError);
@@ -189,7 +189,7 @@ namespace Musify.Infrastructure.Services
} }
catch (Exception exception) catch (Exception exception)
{ {
logger.LogError(exception, "Failed to kill ffmpeg process (PID: {ProcessId})", process.Id); logger.LogError(exception, "Failed to kill ffmpeg process (PID: {ProcessId} )", process.Id);
} }
} }
@@ -276,7 +276,7 @@ namespace Musify.Infrastructure.Services
{ {
listResponse = await amazonS3.ListObjectsV2Async(listRequest, cancellationToken); listResponse = await amazonS3.ListObjectsV2Async(listRequest, cancellationToken);
if (listResponse.S3Objects is null or { Count: 0 }) if (listResponse.S3Objects is null or { Count: 0 } )
break; break;
var deleteRequest = new DeleteObjectsRequest var deleteRequest = new DeleteObjectsRequest