Skip to content

Commit

Permalink
Added async, await to LocalhostClusterTests.cs and Catalog.cs
Browse files Browse the repository at this point in the history
… methods
  • Loading branch information
ivanvyd committed Jul 31, 2024
1 parent 64bd155 commit 803b54d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
4 changes: 2 additions & 2 deletions src/Orleans.Runtime/Catalog/Catalog.cs
Original file line number Diff line number Diff line change
Expand Up @@ -401,7 +401,7 @@ public SiloStatus LocalSiloStatus
}
}

public Task DeleteActivations(List<GrainAddress> addresses, DeactivationReasonCode reasonCode, string reasonText)
public async Task DeleteActivations(List<GrainAddress> addresses, DeactivationReasonCode reasonCode, string reasonText)
{
using var timeoutTokenSource = new CancellationTokenSource(this.collectionOptions.Value.DeactivationTimeout);
var tasks = new List<Task>(addresses.Count);
Expand All @@ -414,7 +414,7 @@ public Task DeleteActivations(List<GrainAddress> addresses, DeactivationReasonCo
}
}

return Task.WhenAll(tasks);
await Task.WhenAll(tasks);
}

// TODO move this logic in the LocalGrainDirectory
Expand Down
7 changes: 3 additions & 4 deletions test/Tester/LocalhostSiloTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting;
using Orleans.Internal;
using Orleans.Runtime;
using Orleans.TestingHost;
using UnitTests.GrainInterfaces;
using Xunit;
Expand Down Expand Up @@ -90,9 +89,9 @@ public async Task LocalhostClusterTest()
{
using var cancelled = new CancellationTokenSource();
cancelled.Cancel();
Utils.SafeExecute(() => silo1.StopAsync(cancelled.Token));
Utils.SafeExecute(() => silo2.StopAsync(cancelled.Token));
Utils.SafeExecute(() => clientHost.StopAsync(cancelled.Token));
await Utils.SafeExecuteAsync(silo1.StopAsync(cancelled.Token));
await Utils.SafeExecuteAsync(silo2.StopAsync(cancelled.Token));
await Utils.SafeExecuteAsync(clientHost.StopAsync(cancelled.Token));
Utils.SafeExecute(() => silo1.Dispose());
Utils.SafeExecute(() => silo2.Dispose());
Utils.SafeExecute(() => clientHost.Dispose());
Expand Down

0 comments on commit 803b54d

Please sign in to comment.