Fix audio DASH workflow: dispose source stream before delete and store S3 folder key as AudioFolderName
This commit is contained in:
@@ -38,11 +38,13 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
|||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
await using var fileStream = File.OpenRead(sourceFilePath);
|
await using (var fileStream = File.OpenRead(sourceFilePath))
|
||||||
|
{
|
||||||
await audioTranscoder.TranscodeToDashAsync(
|
await audioTranscoder.TranscodeToDashAsync(
|
||||||
fileStream,
|
fileStream,
|
||||||
workingDirectory,
|
workingDirectory,
|
||||||
executeContext.CancellationToken);
|
executeContext.CancellationToken);
|
||||||
|
}
|
||||||
|
|
||||||
File.Delete(sourceFilePath);
|
File.Delete(sourceFilePath);
|
||||||
return executeContext.Completed();
|
return executeContext.Completed();
|
||||||
|
|||||||
@@ -31,17 +31,8 @@ namespace Musify.Infrastructure.MassTransit.Activities.Audio
|
|||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
|
|
||||||
string? audioFolderKey;
|
var audioFolderKey = executeContext.Arguments.AudioFolderKey;
|
||||||
try
|
|
||||||
{
|
|
||||||
audioFolderKey = executeContext.GetVariable<string>(executeContext.Arguments.AudioFolderKeyVariable);
|
|
||||||
logger.LogDebug("Resolved audio folder key: {AudioFolderKey}", audioFolderKey);
|
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();
|
|
||||||
}
|
|
||||||
|
|
||||||
if (string.IsNullOrWhiteSpace(audioFolderKey))
|
if (string.IsNullOrWhiteSpace(audioFolderKey))
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -2,5 +2,5 @@
|
|||||||
{
|
{
|
||||||
public record UpdateTrackAudioArguments(
|
public record UpdateTrackAudioArguments(
|
||||||
Guid TrackId,
|
Guid TrackId,
|
||||||
string AudioFolderKeyVariable);
|
string AudioFolderKey);
|
||||||
}
|
}
|
||||||
@@ -58,7 +58,7 @@ namespace Musify.Infrastructure.MassTransit.RoutingSlip.Builders
|
|||||||
EndpointHelper.BuildExecuteActivityUri(UpdateTrackAudioActivity.ExecuteEndpointName),
|
EndpointHelper.BuildExecuteActivityUri(UpdateTrackAudioActivity.ExecuteEndpointName),
|
||||||
new UpdateTrackAudioArguments(
|
new UpdateTrackAudioArguments(
|
||||||
message.TrackId,
|
message.TrackId,
|
||||||
RoutingSlipVariableNames.Audio.TranscodedDirectory));
|
message.DestinationFolderKey));
|
||||||
|
|
||||||
return routingSlipBuilder;
|
return routingSlipBuilder;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user