Skip to content

Commit

Permalink
Revert "Refactor childStats requestRestartPermission algorithm"
Browse files Browse the repository at this point in the history
  • Loading branch information
HCanber committed Mar 1, 2015
1 parent eae216f commit 26f786f
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/core/Akka/Actor/ChildrenContainer/Internal/ChildStats.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,18 @@ public ChildRestartStats(InternalActorRef child, uint maxNrOfRetriesCount = 0, l
public bool RequestRestartPermission(int maxNrOfRetries, int withinTimeMilliseconds)
{
if (maxNrOfRetries == 0) return false;
if (withinTimeMilliseconds == 0)
var retriesIsDefined = maxNrOfRetries > 0;
var windowIsDefined = withinTimeMilliseconds > 0;
if (retriesIsDefined && !windowIsDefined)
{
_maxNrOfRetriesCount++;
return _maxNrOfRetriesCount <= maxNrOfRetries;
}
return RetriesInWindowOkay(maxNrOfRetries, withinTimeMilliseconds);
if (windowIsDefined)
{
return RetriesInWindowOkay(retriesIsDefined ? maxNrOfRetries : 1, withinTimeMilliseconds);
}
return true;
//retriesWindow match {
// case (Some(retries), _) if retries < 1 ⇒ false
// case (Some(retries), None) ⇒ { maxNrOfRetriesCount += 1; maxNrOfRetriesCount <= retries }
Expand All @@ -78,7 +84,7 @@ private bool RetriesInWindowOkay(int retries, int windowInMilliseconds)
{
windowStart = _restartTimeWindowStartTicks;
}
var windowInTicks = windowInMilliseconds*TimeSpan.TicksPerMillisecond;
var windowInTicks = windowInMilliseconds * TimeSpan.TicksPerMillisecond;
var insideWindow = (now - windowStart) <= windowInTicks;

if (insideWindow)
Expand All @@ -90,5 +96,7 @@ private bool RetriesInWindowOkay(int retries, int windowInMilliseconds)
_restartTimeWindowStartTicks = now;
return true;
}


}
}

2 comments on commit 26f786f

@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 74 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 74 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:10:46

Failed tests

Akka.Persistence.Tests.dll: Akka.Persistence.Tests.GuaranteedDeliveryCrashSpec.GuaranteedDelivery_should_not_send_when_actor_crashes: <no details avaliable>

Please sign in to comment.