Changes on messages
This commit is contained in:
@@ -38,9 +38,8 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
|
||||
Directory.CreateDirectory(workingDirectory);
|
||||
|
||||
logger.LogDebug("Generated audio workflow paths. WorkingDirectory={WorkingDirectory}, SourceFilePath={SourceFilePath}",
|
||||
workingDirectory,
|
||||
sourceFilePath);
|
||||
logger.LogDebug("Generated audio workflow paths in {WorkingDirectory}",
|
||||
workingDirectory);
|
||||
|
||||
await processTrackingStore.CompleteStepAsync(processId, stepId, executeContext.CancellationToken);
|
||||
return executeContext.CompletedWithVariables(new Dictionary<string, object>
|
||||
@@ -53,7 +52,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error generating audio workflow paths for key={SourceKey}",
|
||||
logger.LogError(exception, "Failed to generate audio workflow paths for {SourceKey}",
|
||||
executeContext.Arguments.SourceKey);
|
||||
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
||||
throw;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MassTransit;
|
||||
using MassTransit;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Musify.Application.Contracts.Infrastructure;
|
||||
using Musify.Domain.Entities;
|
||||
@@ -48,7 +48,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
if (!result.IsSuccess)
|
||||
{
|
||||
var errorMessage = string.Join("; ", result.Errors);
|
||||
logger.LogError("Transcoding failed for file={SourceFilePath}. Errors={ErrorMessage}",
|
||||
logger.LogError("Transcoding failed for {SourceFilePath}: {Errors}",
|
||||
sourceFilePath, errorMessage);
|
||||
throw new Exception(errorMessage);
|
||||
}
|
||||
@@ -60,7 +60,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error during transcoding activity for file={SourceFilePath}",
|
||||
logger.LogError(exception, "Failed to transcode {SourceFilePath}",
|
||||
sourceFilePath);
|
||||
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
||||
throw;
|
||||
@@ -74,13 +74,13 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
if (Directory.Exists(compensateContext.Log.WorkingDirectory))
|
||||
Directory.Delete(compensateContext.Log.WorkingDirectory, recursive: true);
|
||||
else
|
||||
logger.LogWarning("Working directory={WorkingDirectory} does not exist during compensation",
|
||||
logger.LogWarning("Working directory {WorkingDirectory} not found during compensation",
|
||||
compensateContext.Log.WorkingDirectory);
|
||||
return Task.FromResult(compensateContext.Compensated());
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error compensating transcoded audio directory={WorkingDirectory}", compensateContext.Log.WorkingDirectory);
|
||||
logger.LogError(exception, "Failed to compensate transcoded audio directory {WorkingDirectory}", compensateContext.Log.WorkingDirectory);
|
||||
return Task.FromResult(compensateContext.Failed(exception));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MassTransit;
|
||||
using MassTransit;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Musify.Application.Contracts.Infrastructure;
|
||||
using Musify.Domain.Entities;
|
||||
@@ -39,7 +39,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Audio
|
||||
|
||||
if (track is null)
|
||||
{
|
||||
logger.LogWarning("Track with id={TrackId} not found",
|
||||
logger.LogWarning("Track {TrackId} not found",
|
||||
executeContext.Arguments.TrackId);
|
||||
throw new InvalidOperationException($"Track with id {executeContext.Arguments.TrackId} not found");
|
||||
}
|
||||
@@ -53,7 +53,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Audio
|
||||
database.Tracks.Update(track);
|
||||
await database.SaveChangesAsync(executeContext.CancellationToken);
|
||||
|
||||
logger.LogInformation("Updated Track={TrackId} audio",
|
||||
logger.LogInformation("Updated track {TrackId} audio",
|
||||
executeContext.Arguments.TrackId);
|
||||
|
||||
await processTrackingStore.CompleteStepAsync(processId, stepId, executeContext.CancellationToken);
|
||||
@@ -61,7 +61,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Audio
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error updating Track={TrackId} audio",
|
||||
logger.LogError(exception, "Failed to update track {TrackId} audio",
|
||||
executeContext.Arguments.TrackId);
|
||||
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
||||
throw;
|
||||
@@ -90,7 +90,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Audio
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error compensating Track={TrackId} audio", compensateContext.Log.TrackId);
|
||||
logger.LogError(exception, "Failed to compensate track {TrackId} audio", compensateContext.Log.TrackId);
|
||||
return compensateContext.Failed(exception);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MassTransit;
|
||||
using MassTransit;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Musify.Application.Contracts.Infrastructure;
|
||||
using Musify.Domain.Entities;
|
||||
@@ -44,7 +44,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
if (!getFile.IsSuccess)
|
||||
{
|
||||
var errorMessage = string.Join("; ", getFile.Errors);
|
||||
logger.LogWarning("Failed to download file from bucket. Bucket={Bucket}, Key={Key}, Errors={Errors}",
|
||||
logger.LogWarning("Failed to download {Bucket}/{Key}: {Errors}",
|
||||
executeContext.Arguments.Bucket,
|
||||
executeContext.Arguments.Key,
|
||||
errorMessage);
|
||||
@@ -70,7 +70,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error downloading file from bucket");
|
||||
logger.LogError(exception, "Failed to download file from bucket");
|
||||
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
||||
throw;
|
||||
}
|
||||
@@ -85,7 +85,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error compensating downloaded file={DestinationFilePath}", compensateContext.Log.DestinationFilePath);
|
||||
logger.LogError(exception, "Failed to compensate downloaded file {DestinationFilePath}", compensateContext.Log.DestinationFilePath);
|
||||
return Task.FromResult(compensateContext.Failed(exception));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MassTransit;
|
||||
using MassTransit;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Musify.Application.Contracts.Infrastructure;
|
||||
using Musify.Domain.Entities;
|
||||
@@ -40,7 +40,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
if (!removeFile.IsSuccess)
|
||||
{
|
||||
var errorMessage = string.Join("; ", removeFile.Errors);
|
||||
logger.LogWarning("Failed to remove file={Key} from bucket={Bucket}. Errors={Errors}",
|
||||
logger.LogWarning("Failed to remove {Key} from bucket {Bucket}: {Errors}",
|
||||
executeContext.Arguments.Key,
|
||||
executeContext.Arguments.Bucket,
|
||||
errorMessage);
|
||||
@@ -51,7 +51,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error removing file={Key} from bucket={Bucket}",
|
||||
logger.LogError(exception, "Failed to remove {Key} from bucket {Bucket}",
|
||||
executeContext.Arguments.Key,
|
||||
executeContext.Arguments.Bucket);
|
||||
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MassTransit;
|
||||
using MassTransit;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Musify.Application.Contracts.Infrastructure;
|
||||
using Musify.Domain.Entities;
|
||||
@@ -51,7 +51,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
if (!transferFilesResult.IsSuccess)
|
||||
{
|
||||
var errorMessage = string.Join("; ", transferFilesResult.Errors);
|
||||
logger.LogWarning("Failed to transfer files from={FolderPath} to bucket={DestinationBucket}, key={DestinationKey}. Errors={Errors}",
|
||||
logger.LogWarning("Failed to transfer files from {FolderPath} to {DestinationBucket}/{DestinationKey}: {Errors}",
|
||||
folderPath,
|
||||
executeContext.Arguments.DestinationBucket,
|
||||
destinationKey,
|
||||
@@ -64,7 +64,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error transferring files from={FolderPath} to bucket={DestinationBucket}",
|
||||
logger.LogError(exception, "Failed to transfer files from {FolderPath} to {DestinationBucket}",
|
||||
folderPath,
|
||||
executeContext.Arguments.DestinationBucket);
|
||||
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
||||
@@ -88,7 +88,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error compensating transferred files to bucket={DestinationBucket}", compensateContext.Log.DestinationBucket);
|
||||
logger.LogError(exception, "Failed to compensate file transfers to {DestinationBucket}", compensateContext.Log.DestinationBucket);
|
||||
return compensateContext.Failed(exception);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MassTransit;
|
||||
using MassTransit;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using MimeMapping;
|
||||
using Musify.Application.Contracts.Infrastructure;
|
||||
@@ -46,7 +46,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Files
|
||||
if (!uploadResult.IsSuccess)
|
||||
{
|
||||
var errors = string.Join("; ", uploadResult.Errors);
|
||||
logger.LogWarning("Failed to upload file to bucket. Bucket={Bucket}, Key={Key}, Errors={Errors}",
|
||||
logger.LogWarning("Failed to upload file to bucket {Bucket}/{Route}: {Errors}",
|
||||
executeContext.Arguments.DestinationBucket,
|
||||
executeContext.Arguments.DestinationRoute,
|
||||
errors);
|
||||
@@ -60,7 +60,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Files
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "An error occurred while uploading file to bucket for process={ProcessId} at step={StepId}", processId, stepId);
|
||||
logger.LogError(exception, "Failed to upload file to bucket for process {ProcessId} step {StepId}", processId, stepId);
|
||||
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
||||
throw;
|
||||
}
|
||||
@@ -78,7 +78,8 @@ namespace Musify.Infrastructure.MassTransit.Activities.Files
|
||||
if (!uploadResult.IsSuccess)
|
||||
{
|
||||
var errors = string.Join("; ", uploadResult.Errors);
|
||||
logger.LogError($"Failed to remove file from bucket during compensation. Bucket={compensateContext.Log.DestinationBucket}, Key={compensateContext.Log.DestinationKey}, Errors={errors}");
|
||||
logger.LogError("Failed to remove file from bucket during compensation. Bucket: {Bucket}, Key: {Key}, Errors: {Errors}",
|
||||
compensateContext.Log.DestinationBucket, compensateContext.Log.DestinationKey, errors);
|
||||
|
||||
return compensateContext.Failed(new Exception($"Failed to remove file from bucket during compensation. Bucket: {compensateContext.Log.DestinationBucket}, Key: {compensateContext.Log.DestinationKey}, Errors: {errors}"));
|
||||
}
|
||||
@@ -86,7 +87,7 @@ namespace Musify.Infrastructure.MassTransit.Activities.Files
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "An error occurred while compensating upload file to bucket activity for bucket={Bucket} and key={Key}",
|
||||
logger.LogError(exception, "Error compensating file upload for {Bucket}/{Key}",
|
||||
compensateContext.Log.DestinationBucket,
|
||||
compensateContext.Log.DestinationKey);
|
||||
return compensateContext.Failed(exception);
|
||||
|
||||
+3
-4
@@ -47,9 +47,8 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
|
||||
Directory.CreateDirectory(workingDirectory);
|
||||
|
||||
logger.LogDebug("Generated picture workflow paths. WorkingDirectory={WorkingDirectory}, SourceFilePath={SourceFilePath}",
|
||||
workingDirectory,
|
||||
sourceFilePath);
|
||||
logger.LogDebug("Generated picture workflow paths in {WorkingDirectory}",
|
||||
workingDirectory);
|
||||
|
||||
await processTrackingStore.CompleteStepAsync(processId, stepId, executeContext.CancellationToken);
|
||||
return executeContext.CompletedWithVariables(new Dictionary<string, object>
|
||||
@@ -64,7 +63,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error generating picture workflow paths for key={SourceKey}",
|
||||
logger.LogError(exception, "Failed to generate picture workflow paths for {SourceKey}",
|
||||
executeContext.Arguments.SourceKey);
|
||||
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
||||
throw;
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MassTransit;
|
||||
using MassTransit;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Musify.Application.Contracts.Infrastructure;
|
||||
using Musify.Domain.Entities;
|
||||
@@ -41,7 +41,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
{
|
||||
if (!File.Exists(sourceFilePath))
|
||||
{
|
||||
logger.LogWarning("Source file not found at={SourceFilePath}", sourceFilePath);
|
||||
logger.LogWarning("Source file not found: {SourceFilePath}", sourceFilePath);
|
||||
throw new FileNotFoundException($"Source file not found: {sourceFilePath}");
|
||||
}
|
||||
|
||||
@@ -56,7 +56,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
if (!resizedPicture.IsSuccess)
|
||||
{
|
||||
var errorMessage = string.Join("; ", resizedPicture.Errors);
|
||||
logger.LogError("Failed to resize picture={SourceFilePath} to={Width}x{Height}. Errors={Errors}",
|
||||
logger.LogError("Failed to resize picture {SourceFilePath} to {Width}x{Height}: {Errors}",
|
||||
sourceFilePath,
|
||||
executeContext.Arguments.Width,
|
||||
executeContext.Arguments.Height,
|
||||
@@ -71,7 +71,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
await using var destinationStream = File.Create(destinationFilePath);
|
||||
await resizedPicture.Value.CopyToAsync(destinationStream, executeContext.CancellationToken);
|
||||
|
||||
logger.LogDebug("Picture resized from={SourceFilePath} to={DestinationFilePath}",
|
||||
logger.LogDebug("Resized picture from {SourceFilePath} to {DestinationFilePath}",
|
||||
sourceFilePath,
|
||||
destinationFilePath);
|
||||
|
||||
@@ -80,7 +80,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error resizing picture={SourceFilePath}", sourceFilePath);
|
||||
logger.LogError(exception, "Failed to resize picture {SourceFilePath}", sourceFilePath);
|
||||
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
||||
throw;
|
||||
}
|
||||
@@ -95,7 +95,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error compensating resized file={DestinationFilePath}", compensateContext.Log.DestinationFilePath);
|
||||
logger.LogError(exception, "Failed to compensate resized file {DestinationFilePath}", compensateContext.Log.DestinationFilePath);
|
||||
return Task.FromResult(compensateContext.Failed(exception));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MassTransit;
|
||||
using MassTransit;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Musify.Application.Contracts.Infrastructure;
|
||||
using Musify.Domain.Entities;
|
||||
@@ -46,7 +46,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
|
||||
if (playList is null)
|
||||
{
|
||||
logger.LogWarning("PlayList with id={PlayListId} not found",
|
||||
logger.LogWarning("Playlist {PlayListId} not found",
|
||||
executeContext.Arguments.PlayListId);
|
||||
throw new InvalidOperationException($"PlayList with id {executeContext.Arguments.PlayListId} not found");
|
||||
}
|
||||
@@ -66,7 +66,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
database.PlayLists.Update(playList);
|
||||
await database.SaveChangesAsync(executeContext.CancellationToken);
|
||||
|
||||
logger.LogInformation("Updated PlayList={PlayListId} pictures",
|
||||
logger.LogInformation("Updated playlist {PlayListId} pictures",
|
||||
executeContext.Arguments.PlayListId);
|
||||
|
||||
await processTrackingStore.CompleteStepAsync(processId, stepId, executeContext.CancellationToken);
|
||||
@@ -74,7 +74,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error updating PlayList={PlayListId} pictures",
|
||||
logger.LogError(exception, "Failed to update playlist {PlayListId} pictures",
|
||||
executeContext.Arguments.PlayListId);
|
||||
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
||||
throw;
|
||||
@@ -106,7 +106,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error compensating PlayList={PlayListId} pictures", compensateContext.Log.PlayListId);
|
||||
logger.LogError(exception, "Failed to compensate playlist {PlayListId} pictures", compensateContext.Log.PlayListId);
|
||||
return compensateContext.Failed(exception);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using MassTransit;
|
||||
using MassTransit;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Musify.Application.Contracts.Infrastructure;
|
||||
using Musify.Domain.Entities;
|
||||
@@ -46,7 +46,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
|
||||
if (track is null)
|
||||
{
|
||||
logger.LogWarning("Track with id={TrackId} not found",
|
||||
logger.LogWarning("Track {TrackId} not found",
|
||||
executeContext.Arguments.TrackId);
|
||||
throw new InvalidOperationException($"Track with id {executeContext.Arguments.TrackId} not found");
|
||||
}
|
||||
@@ -66,7 +66,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
database.Tracks.Update(track);
|
||||
await database.SaveChangesAsync(executeContext.CancellationToken);
|
||||
|
||||
logger.LogInformation("Updated Track={TrackId} pictures",
|
||||
logger.LogInformation("Updated track {TrackId} pictures",
|
||||
executeContext.Arguments.TrackId);
|
||||
|
||||
await processTrackingStore.CompleteStepAsync(processId, stepId, executeContext.CancellationToken);
|
||||
@@ -74,7 +74,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error updating Track={TrackId} pictures",
|
||||
logger.LogError(exception, "Failed to update track {TrackId} pictures",
|
||||
executeContext.Arguments.TrackId);
|
||||
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
||||
throw;
|
||||
@@ -106,7 +106,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error compensating Track={TrackId} pictures", compensateContext.Log.TrackId);
|
||||
logger.LogError(exception, "Failed to compensate track {TrackId} pictures", compensateContext.Log.TrackId);
|
||||
return compensateContext.Failed(exception);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user