Fix audio DASH workflow: dispose source stream before delete and store S3 folder key as AudioFolderName

This commit is contained in:
2026-05-31 19:25:15 +02:00
parent 69cc73c374
commit 253a67aabf
4 changed files with 11 additions and 18 deletions
@@ -38,11 +38,13 @@ namespace Musify.Infrastructure.MassTransit.Activities
try
{
await using var fileStream = File.OpenRead(sourceFilePath);
await audioTranscoder.TranscodeToDashAsync(
fileStream,
workingDirectory,
executeContext.CancellationToken);
await using (var fileStream = File.OpenRead(sourceFilePath))
{
await audioTranscoder.TranscodeToDashAsync(
fileStream,
workingDirectory,
executeContext.CancellationToken);
}
File.Delete(sourceFilePath);
return executeContext.Completed();
@@ -31,17 +31,8 @@ namespace Musify.Infrastructure.MassTransit.Activities.Audio
throw;
}
string? audioFolderKey;
try
{
audioFolderKey = executeContext.GetVariable<string>(executeContext.Arguments.AudioFolderKeyVariable);
logger.LogDebug("Resolved audio folder key: {AudioFolderKey}", audioFolderKey);
}
catch (Exception exception)
{
logger.LogWarning(exception, "Audio folder key variable could not be resolved for track {TrackId}", track.Id);
return executeContext.Completed();
}
var audioFolderKey = executeContext.Arguments.AudioFolderKey;
logger.LogDebug("Resolved audio folder key: {AudioFolderKey}", audioFolderKey);
if (string.IsNullOrWhiteSpace(audioFolderKey))
{