Skip to content

Commit

Permalink
close #2797 - prevent NRE on TestKit shutdown
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaronontheweb committed Jun 25, 2017
1 parent 8b54a73 commit 1608a3f
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/core/Akka.TestKit/TestKitBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -409,12 +409,12 @@ public virtual void Shutdown(TimeSpan? duration = null, bool verifySystemShutdow
/// <param name="system">The system to shutdown.</param>
/// <param name="duration">The duration to wait for shutdown. Default is 5 seconds multiplied with the config value "akka.test.timefactor"</param>
/// <param name="verifySystemShutdown">if set to <c>true</c> an exception will be thrown on failure.</param>
/// <exception cref="TimeoutException">TBD</exception>
/// <exception cref="TimeoutException">Thrown if we can't verify that the <see cref="ActorSystem"/> was shutdown within the given length of time.</exception>
protected virtual void Shutdown(ActorSystem system, TimeSpan? duration = null, bool verifySystemShutdown = false)
{
if (system == null) system = _testState.System;

var durationValue = duration.GetValueOrDefault(Dilated(TimeSpan.FromSeconds(5)).Min(TimeSpan.FromSeconds(10)));
var durationValue = (duration ?? Dilated(TimeSpan.FromSeconds(5))).Min(TimeSpan.FromSeconds(10));

var wasShutdownDuringWait = system.Terminate().Wait(durationValue);
if(!wasShutdownDuringWait)
Expand Down

0 comments on commit 1608a3f

Please sign in to comment.