Skip to content

Commit

Permalink
close #2463 - used AwaitAssert to avoid race condition with temp acto…
Browse files Browse the repository at this point in the history
…rs deregistering (#2473)
  • Loading branch information
Aaronontheweb authored and Danthar committed Jan 25, 2017
1 parent 9c48f78 commit 8f101a2
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/core/Akka.Tests/Actor/AskSpec.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,10 +116,17 @@ private void Are_Temp_Actors_Removed(IActorRef actor)
{
var actorCell = actor as ActorRefWithCell;
Assert.True(actorCell != null, "Test method only valid with ActorRefWithCell actors.");
// ReSharper disable once PossibleNullReferenceException
var container = actorCell.Provider.TempContainer as VirtualPathContainer;
int childCounter = 0;
container.ForEachChild(x => childCounter++);
Assert.True(childCounter == 0, "Temp actors not all removed.");

AwaitAssert(() =>
{
var childCounter = 0;
// ReSharper disable once PossibleNullReferenceException
container.ForEachChild(x => childCounter++);
Assert.True(childCounter == 0, "Temp actors not all removed.");
});

}

/// <summary>
Expand Down

0 comments on commit 8f101a2

Please sign in to comment.