Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -812,6 +812,7 @@ private sealed class ContinueAsNewHandler : IExecutionHandler
{
public const string HandlerId = "qualification.temporal.continue-as-new";
public const int CycleCount = 18;
private static readonly TimeSpan CycleDelay = TimeSpan.FromMilliseconds(300);
private const string CheckpointKey = "continue-as-new-cycles";

public ExecutionHandlerDescriptor Descriptor { get; } = new()
Expand All @@ -827,9 +828,11 @@ public async Task<ExecutionRunResult> ExecuteAsync(IExecutionRunContext context,
while (completedCycles < CycleCount)
{
var nextCycle = completedCycles + 1;
// Keep the timer ahead of a persistence round trip so every cycle exercises
// the durable suspend/resume path rather than the valid immediate-elapsed path.
_ = await context.WaitForTimerAsync(
$"continue-as-new-{nextCycle}",
DateTime.UtcNow.AddMilliseconds(50),
DateTime.UtcNow.Add(CycleDelay),
ct: ct);
completedCycles = nextCycle;
await context.PutCheckpointAsync(new ExecutionCheckpointWrite
Expand Down
Loading