Skip to content

Commit 838dd6a

Browse files
authored
Remove unused IScheduleRestart interface and its dead registration plumbing (#165)
The IScheduleRestart interface existed only to be stored in FlowsManager._scheduleRestarts, a write-only dictionary that fed the immediate in-process restart of an idle target - a path already disabled as a stopgap. Since it was populated but never read, remove it entirely: - Delete IScheduleRestart.cs - Drop the interface from Invoker (and its explicit-impl adapter) - Remove _scheduleRestarts and RegisterScheduleRestart from FlowsManager, trimming the stopgap remarks that documented the dead plumbing - Remove the three RegisterScheduleRestart calls in FunctionsRegistry Schedule() still delivers via the durable interrupt + PostponedWatchdog, so behaviour is unchanged.
1 parent f2c33db commit 838dd6a

4 files changed

Lines changed: 1 addition & 34 deletions

File tree

Core/Cleipnir.ResilientFunctions/CoreRuntime/FlowsManager.cs

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,6 @@ namespace Cleipnir.ResilientFunctions.CoreRuntime;
1010
public class FlowsManager : IFlowsManager
1111
{
1212
private readonly Dictionary<StoredId, FlowState> _dict = new();
13-
private readonly Dictionary<StoredType, IScheduleRestart> _scheduleRestarts = new();
1413
private readonly IFunctionStore _functionStore;
1514
private readonly Lock _lock = new();
1615

@@ -54,27 +53,12 @@ public Task Push(IReadOnlyDictionary<StoredId, List<StoredMessage>> messagesByFl
5453
return Task.WhenAll(tasks);
5554
}
5655

57-
public void RegisterScheduleRestart(StoredType storedType, IScheduleRestart scheduleRestart)
58-
{
59-
lock (_lock)
60-
_scheduleRestarts[storedType] = scheduleRestart;
61-
}
62-
6356
/// <summary>
6457
/// Wakes the target flow so it consumes the just-published message by applying the durable interrupt
6558
/// (interrupted flag + expires=0) - the suspend-race guard and watchdog backstop, so the message is never
6659
/// lost even when the target suspends concurrently or is owned by another replica. An idle target this
6760
/// replica executes is then picked up by the PostponedWatchdog.
6861
/// </summary>
69-
/// <remarks>
70-
/// STOPGAP: the immediate in-process restart of an idle target - look up <see cref="_scheduleRestarts"/>
71-
/// by <see cref="StoredId.Type"/> for a flow not in <c>_dict</c> and await
72-
/// <see cref="IScheduleRestart.ScheduleRestart"/> - is disabled. It races with the suspend/resume
73-
/// machinery and deadlocks the ping-pong / multi-flow message exchange. The durable interrupt below still
74-
/// guarantees delivery via the PostponedWatchdog. Restore the immediate restart once the suspension rework
75-
/// lands. <see cref="RegisterScheduleRestart"/> keeps populating <see cref="_scheduleRestarts"/> so that
76-
/// re-enabling is a local change here.
77-
/// </remarks>
7862
public Task Schedule(StoredId storedId)
7963
=> _functionStore.Interrupt(storedId);
8064
}

Core/Cleipnir.ResilientFunctions/CoreRuntime/IScheduleRestart.cs

Lines changed: 0 additions & 12 deletions
This file was deleted.

Core/Cleipnir.ResilientFunctions/CoreRuntime/Invocation/Invoker.cs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111

1212
namespace Cleipnir.ResilientFunctions.CoreRuntime.Invocation;
1313

14-
public class Invoker<TParam, TReturn> : IScheduleRestart
14+
public class Invoker<TParam, TReturn>
1515
{
1616
private readonly FlowType _flowType;
1717
private readonly StoredType _storedType;
@@ -203,8 +203,6 @@ public async Task<InnerScheduled<TReturn>> ScheduleRestart(StoredId storedId)
203203
return _invocationHelper.CreateInnerScheduled([flowId], parentWorkflow: null, detach: null, tcs.Task);
204204
}
205205

206-
Task IScheduleRestart.ScheduleRestart(StoredId storedId) => ScheduleRestart(storedId);
207-
208206
internal async Task ScheduleRestart(StoredId storedId, RestartedFunction rf, Action onCompletion)
209207
{
210208
var tcs = new TaskCompletionSource<TReturn>();

Core/Cleipnir.ResilientFunctions/FunctionsRegistry.cs

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,6 @@ public FuncRegistration<TParam, TReturn> RegisterFunc<TParam, TReturn>(
259259
_flowsManager
260260
);
261261

262-
_flowsManager.RegisterScheduleRestart(storedType, invoker);
263262
WatchDogsFactory.CreateAndStart(
264263
flowType,
265264
storedType,
@@ -345,7 +344,6 @@ private ParamlessRegistration RegisterParamless(
345344
_flowsManager
346345
);
347346

348-
_flowsManager.RegisterScheduleRestart(storedType, invoker);
349347
WatchDogsFactory.CreateAndStart(
350348
flowType,
351349
storedType,
@@ -431,7 +429,6 @@ public ActionRegistration<TParam> RegisterAction<TParam>(
431429
_flowsManager
432430
);
433431

434-
_flowsManager.RegisterScheduleRestart(storedType, rActionInvoker);
435432
WatchDogsFactory.CreateAndStart(
436433
flowType,
437434
storedType,

0 commit comments

Comments
 (0)