Skip to content

Commit

Permalink
Update Program.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
kr-santosh committed Jan 6, 2022
1 parent 7385654 commit bcf2b81
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions Microsoft.Azure.Cosmos.Samples/Usage/ReEncryption/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,10 @@ private static async Task CreateAndRunReEncryptionTasks()

Console.WriteLine("\n ReEncryption in progress. Press esc key to exit. \n");

Task reEncryptionProgress = Program.CheckReEncryptionProgressOrCancelReEncryptionTasksAsync(sourceContainer, targetContainer, cancellationTokenSource);
Task reEncryptionProgress = Program.CheckReEncryptionProgressOrCancelReEncryptionTasksAsync(
sourceContainer,
targetContainer,
cancellationTokenSource);

try
{
Expand Down Expand Up @@ -285,7 +288,11 @@ private static async Task ExecuteReEncrytionAsync(
ReEncryptionResponseMessage responseMessage;
do
{
responseMessage = await Program.ReEncryptNextAsync(sourceContainer, feedRange, continuationToken, cancellationToken);
responseMessage = await Program.ReEncryptNextAsync(
sourceContainer,
feedRange,
continuationToken,
cancellationToken);

if (responseMessage.ContinuationToken != null)
{
Expand Down Expand Up @@ -321,6 +328,7 @@ private static async Task<ReEncryptionResponseMessage> ReEncryptNextAsync(
{
responseMessage = await iterator.EncryptNextAsync(cancellationToken);
File.WriteAllText(ContinuationTokenFile + sourceContainer.Id + feedRange.ToString(), responseMessage.ContinuationToken);

if (responseMessage.StatusCode == HttpStatusCode.NotModified)
{
break;
Expand All @@ -329,7 +337,10 @@ private static async Task<ReEncryptionResponseMessage> ReEncryptNextAsync(

if (iterator.HasMoreResults == false)
{
return new ReEncryptionResponseMessage(responseMessage, null, responseMessage.ReEncryptionBulkOperationResponse);
return new ReEncryptionResponseMessage(
responseMessage: responseMessage,
reEncryptionContinuationToken: null,
reEncryptionBulkOperationResponse: responseMessage.ReEncryptionBulkOperationResponse);
}

return responseMessage;
Expand Down

0 comments on commit bcf2b81

Please sign in to comment.