Skip to content

Commit 931775a

Browse files
authored
Do not use expression based options for backoff props (#6805)
1 parent 8372f75 commit 931775a

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

src/core/Akka/Pattern/BackoffOnRestartSupervisor.cs

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ internal sealed class BackoffOnRestartSupervisor : BackoffSupervisorBase
2424
private readonly OneForOneStrategy _strategy;
2525
private readonly ILoggingAdapter _log = Context.GetLogger();
2626

27+
/// <devremarks>
28+
/// If the arguments here change, you -must- change the invocation in <see cref="BackoffOptions"/> accordingly!
29+
/// Expression based props are too slow for many scenarios, so we must drop compile time safety for that sake.
30+
/// </devremarks>
2731
public BackoffOnRestartSupervisor(
2832
Props childProps,
2933
string childName,

src/core/Akka/Pattern/BackoffOptions.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -210,9 +210,9 @@ internal override Props Props
210210
switch (_backoffType)
211211
{
212212
case RestartImpliesFailure _:
213-
return Props.Create(() => new BackoffOnRestartSupervisor(_childProps, _childName, _minBackoff, _maxBackoff, _reset, _randomFactor, _strategy, _replyWhileStopped, _finalStopMessage));
213+
return Props.Create<BackoffOnRestartSupervisor>(_childProps, _childName, _minBackoff, _maxBackoff, _reset, _randomFactor, _strategy, _replyWhileStopped, _finalStopMessage);
214214
case StopImpliesFailure _:
215-
return Props.Create(() => new BackoffSupervisor(_childProps, _childName, _minBackoff, _maxBackoff, _reset, _randomFactor, _strategy, _replyWhileStopped, _finalStopMessage));
215+
return Props.Create<BackoffSupervisor>(_childProps, _childName, _minBackoff, _maxBackoff, _reset, _randomFactor, _strategy, _replyWhileStopped, _finalStopMessage);
216216
default:
217217
return Props.Empty;
218218
}

src/core/Akka/Pattern/BackoffSupervisor.cs

+4
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,10 @@ public BackoffSupervisor(
117117
{
118118
}
119119

120+
/// <summary>
121+
/// If the arguments here change, you -must- change the invocation in <see cref="BackoffOptions"/> accordingly!
122+
/// Expression based props are too slow for many scenarios, so we must drop compile time safety for that sake.
123+
/// </summary>
120124
public BackoffSupervisor(
121125
Props childProps,
122126
string childName,

0 commit comments

Comments
 (0)