Skip to content

Commit

Permalink
#5916 fix multiple drop things (#5917)
Browse files Browse the repository at this point in the history
* #5916 fix multiple drop things

* Update orleans/Adventure/AdventureGrains/PlayerGrain.cs

---------

Co-authored-by: David Pine <david.pine@microsoft.com>
  • Loading branch information
ondrelogin and IEvangelist committed Jun 23, 2023
1 parent 65014b1 commit a74e411
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions orleans/Adventure/AdventureGrains/PlayerGrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,12 @@ public override Task OnActivateAsync(CancellationToken cancellationToken)
async Task IPlayerGrain.Die()
{
// Drop everything
var tasks = _things.Select(Drop).ToList();
await Task.WhenAll(tasks);
var dropTasks = new List<Task<string?>>();
foreach (var thing in _things.ToArray() /* New collection */)
{
dropTasks.Add(Drop(thing));
}
await Task.WhenAll(dropTasks);

// Exit the game
if (_roomGrain is not null && _myInfo is not null)
Expand Down

0 comments on commit a74e411

Please sign in to comment.