refactor(infra): S3 client singleton, ffmpeg pipe ordering, tidy streams/jobs
- Register IAmazonS3 as a singleton instead of scoped: the AWS SDK client is thread-safe and manages its own connection pool, so one instance per DI scope (per request / per job iteration) was wasteful and risked socket exhaustion - AudioTranscoderService: start reading stdout/stderr before writing stdin to remove the latent pipe-buffer deadlock shape - Dispose the resized-picture MemoryStream in ResizePictureActivity - Background jobs use PeriodicTimer instead of while + Task.Delay Verified: Worker boots against RabbitMQ + Postgres in Docker with no captive- dependency error (dev scope validation) and both jobs start. Build: 0 warnings, 0 errors. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
+1
-1
@@ -30,7 +30,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Pictures
|
||||
|
||||
await using var fileStream = File.OpenRead(sourceFilePath);
|
||||
|
||||
var resizedPicture = await pictureHandler.ResizePictureAsWebpAsync(
|
||||
await using var resizedPicture = await pictureHandler.ResizePictureAsWebpAsync(
|
||||
fileStream,
|
||||
executeContext.Arguments.Width,
|
||||
executeContext.Arguments.Height,
|
||||
|
||||
Reference in New Issue
Block a user