Skip to content

Commit

Permalink
Revert parts of #691 "refactor suspend children"
Browse files Browse the repository at this point in the history
This reverts commit a435803.

The previous version was optimized for the most common scenario, when exceptFor == null.
The LINQ expression introduced in #691 is creating a list every time and uses more enumerators.
  • Loading branch information
HCanber committed Mar 1, 2015
1 parent eae216f commit b509686
Showing 1 changed file with 17 additions and 7 deletions.
24 changes: 17 additions & 7 deletions src/core/Akka/Actor/ActorCell.Children.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading;
using Akka.Actor.Internal;
using Akka.Util;
Expand Down Expand Up @@ -198,12 +197,23 @@ protected void SetTerminated()
/// </summary>
private void SuspendChildren(List<ActorRef> exceptFor = null)
{
var except = exceptFor ?? Enumerable.Empty<ActorRef>();
(from s in ChildrenContainer.Stats
where !except.Contains(s.Child)
select s.Child)
.ToList()
.ForEach(c => c.Suspend());
if (exceptFor == null)
{
foreach (var stats in ChildrenContainer.Stats)
{
var child = stats.Child;
child.Suspend();
}
}
else
{
foreach (var stats in ChildrenContainer.Stats)
{
var child = stats.Child;
if (!exceptFor.Contains(child))
child.Suspend();
}
}
}

/// <summary>
Expand Down

2 comments on commit b509686

@Petabridge-CI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Akka.NET :: Akka.NET PR Build Build 76 is now running

@Petabridge-CI
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TeamCity Akka.NET :: Akka.NET PR Build Build 76 outcome was FAILURE
Summary: System.Exception: xUnit failed for the following assemblies: D:\BuildAgent\work\49b164d63843fb4\src\core\Akka.Persistence.Tests\bin\Release\Akka.Persistence.Tests.dll at Microsoft.FSharp.Core.Operators.FailWith[T](String message) at Fake.XUnitHel... Build time: 00:08:58

Failed tests

Akka.Persistence.Tests.dll: Akka.Persistence.Tests.SnapshotSpec.PersistentActor_should_recover_state_starting_from_the_most_recent_snapshot_matching_an_upper_sequence_number_bound: <no details avaliable>

Please sign in to comment.