Rename variables
This commit is contained in:
@@ -31,22 +31,21 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
0,
|
||||
executeContext.CancellationToken);
|
||||
|
||||
var folderPath = executeContext.GetVariable<string>(executeContext.Arguments.SourceDirectoryVariableName);
|
||||
var folderPath = executeContext.GetVariable<string>(executeContext.Arguments.SourceDirectoryVariable);
|
||||
ArgumentNullException.ThrowIfNull(folderPath, nameof(folderPath));
|
||||
|
||||
var destinationKeyName = executeContext.Arguments.DestinationKeyName;
|
||||
ArgumentNullException.ThrowIfNull(destinationKeyName, nameof(destinationKeyName));
|
||||
var destinationKey = executeContext.Arguments.DestinationKey;
|
||||
ArgumentNullException.ThrowIfNull(destinationKey, nameof(destinationKey));
|
||||
|
||||
try
|
||||
{
|
||||
var uploadedKeys = Directory.GetFiles(folderPath)
|
||||
.Select(file => Path.Combine(destinationKeyName, Path.GetFileName(file)))
|
||||
.Select(file => Path.Combine(destinationKey, Path.GetFileName(file)))
|
||||
.ToArray();
|
||||
|
||||
var transferFilesResult = await storageHandler.TransferFilesAsync(
|
||||
folderPath,
|
||||
executeContext.Arguments.DestinationBucketName,
|
||||
destinationKeyName,
|
||||
executeContext.Arguments.DestinationBucket,
|
||||
destinationKey,
|
||||
executeContext.CancellationToken);
|
||||
|
||||
if (!transferFilesResult.IsSuccess)
|
||||
@@ -54,8 +53,8 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
var errorMessage = string.Join("; ", transferFilesResult.Errors);
|
||||
logger.LogWarning("Failed to transfer files from {FolderPath} to bucket {DestinationBucketName}, key {DestinationKeyName}. Errors: {Errors}",
|
||||
folderPath,
|
||||
executeContext.Arguments.DestinationBucketName,
|
||||
destinationKeyName,
|
||||
executeContext.Arguments.DestinationBucket,
|
||||
destinationKey,
|
||||
errorMessage);
|
||||
throw new Exception(errorMessage);
|
||||
}
|
||||
@@ -67,7 +66,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
{
|
||||
logger.LogError(exception, "Error transferring files from {FolderPath} to bucket {DestinationBucketName}",
|
||||
folderPath,
|
||||
executeContext.Arguments.DestinationBucketName);
|
||||
executeContext.Arguments.DestinationBucket);
|
||||
await processTrackingStore.FailStepAsync(processId, stepId, exception.Message, executeContext.CancellationToken);
|
||||
throw;
|
||||
}
|
||||
@@ -80,7 +79,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
foreach (var uploadedKey in compensateContext.Log.UploadedKeys)
|
||||
{
|
||||
await storageHandler.RemoveFileAsync(
|
||||
compensateContext.Log.DestinationBucketName,
|
||||
compensateContext.Log.DestinationBucket,
|
||||
uploadedKey,
|
||||
compensateContext.CancellationToken);
|
||||
}
|
||||
@@ -89,7 +88,7 @@ namespace Musify.Infrastructure.MassTransit.Activities
|
||||
}
|
||||
catch (Exception exception)
|
||||
{
|
||||
logger.LogError(exception, "Error compensating transferred files to bucket {DestinationBucketName}", compensateContext.Log.DestinationBucketName);
|
||||
logger.LogError(exception, "Error compensating transferred files to bucket {DestinationBucketName}", compensateContext.Log.DestinationBucket);
|
||||
return compensateContext.Failed(exception);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user