Review: Don't double log exception
This commit is contained in:
parent
a7d778ad50
commit
5ad6f2c568
2 changed files with 5 additions and 4 deletions
|
|
@ -685,7 +685,7 @@ class SupervisionSpec extends ScalaTestWithActorTestKit(
|
|||
) {
|
||||
|
||||
EventFilter[ActorInitializationException](occurrences = 1).intercept {
|
||||
EventFilter[TE](occurrences = 2).intercept {
|
||||
EventFilter[TE](occurrences = 1).intercept {
|
||||
spawn(behv)
|
||||
|
||||
// restarted 2 times before it gave up
|
||||
|
|
|
|||
|
|
@ -38,8 +38,8 @@ import scala.util.control.NonFatal
|
|||
}
|
||||
|
||||
/**
|
||||
* INTERNAL API
|
||||
*/
|
||||
* INTERNAL API
|
||||
*/
|
||||
@InternalApi
|
||||
private abstract class AbstractSupervisor[O, I, Thr <: Throwable](strategy: SupervisorStrategy)(implicit ev: ClassTag[Thr]) extends BehaviorInterceptor[O, I] {
|
||||
|
||||
|
|
@ -132,10 +132,11 @@ private class RestartSupervisor[T, Thr <: Throwable](initial: Behavior[T], strat
|
|||
} catch {
|
||||
case NonFatal(t: Thr) ⇒
|
||||
// if unlimited restarts then don't restart if starting fails as it would likely be an infinite restart loop
|
||||
log(ctx, t)
|
||||
if (strategy.unlimitedRestarts() || ((restarts + 1) >= strategy.maxNrOfRetries && deadlineHasTimeLeft)) {
|
||||
// don't log here as it'll be logged as ActorInitializationException
|
||||
throw t
|
||||
} else {
|
||||
log(ctx, t)
|
||||
restart(ctx, t)
|
||||
aroundStart(ctx, target)
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue