Update inactivity threshold and adjust related timings
Renamed 'WorkflowLivenessThreshold' to 'InactivityThreshold' for clarity and updated its usage across affected files. Adjusted timings for workflow restarts and delays to improve consistency, including increasing task delay and updating scheduler intervals. These changes enhance readability and align with revised task execution timelines.
This commit is contained in:
parent
3bbb057378
commit
037b82dc49
|
|
@ -681,13 +681,13 @@ services.Configure<RecurringTaskOptions>(options =>
|
|||
options.Schedule.ConfigureTask<TriggerBookmarkQueueRecurringTask>(TimeSpan.FromSeconds(300));
|
||||
options.Schedule.ConfigureTask<PurgeBookmarkQueueRecurringTask>(TimeSpan.FromSeconds(300));
|
||||
options.Schedule.ConfigureTask<UpdateExpiredSecretsRecurringTask>(TimeSpan.FromHours(4));
|
||||
options.Schedule.ConfigureTask<RestartInterruptedWorkflowsTask>(TimeSpan.FromSeconds(15));
|
||||
options.Schedule.ConfigureTask<RestartInterruptedWorkflowsTask>(TimeSpan.FromMinutes(1));
|
||||
});
|
||||
|
||||
services.Configure<RuntimeOptions>(options => { options.WorkflowLivenessThreshold = TimeSpan.FromSeconds(15); });
|
||||
services.Configure<RuntimeOptions>(options => { options.InactivityThreshold = TimeSpan.FromMinutes(1); });
|
||||
services.Configure<BookmarkQueuePurgeOptions>(options => options.Ttl = TimeSpan.FromSeconds(10));
|
||||
|
||||
services.Configure<CachingOptions>(options => options.CacheDuration = TimeSpan.FromDays(1));
|
||||
|
||||
services.AddHealthChecks();
|
||||
services.AddControllers();
|
||||
services.AddCors(cors => cors.AddDefaultPolicy(policy => policy.AllowAnyHeader().AllowAnyMethod().AllowAnyOrigin().WithExposedHeaders("*")));
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ public class SlowActivity : CodeActivity
|
|||
protected override async ValueTask ExecuteAsync(ActivityExecutionContext context)
|
||||
{
|
||||
Console.WriteLine("Starting...");
|
||||
await Task.Delay(TimeSpan.FromMinutes(1));
|
||||
await Task.Delay(TimeSpan.FromMinutes(2));
|
||||
Console.WriteLine("Done.");
|
||||
}
|
||||
}
|
||||
|
|
@ -11,7 +11,7 @@ public class WorkflowHeartbeatMiddleware(WorkflowMiddlewareDelegate next, IOptio
|
|||
{
|
||||
public override async ValueTask InvokeAsync(WorkflowExecutionContext context)
|
||||
{
|
||||
var livenessThreshold = options.Value.WorkflowLivenessThreshold;
|
||||
var livenessThreshold = options.Value.InactivityThreshold;
|
||||
var heartbeatInterval = TimeSpan.FromTicks((long)(livenessThreshold.Ticks * 0.6));
|
||||
logger.LogDebug("Workflow heartbeat interval: {Interval}", heartbeatInterval);
|
||||
using var heartbeat = new WorkflowHeartbeat(async () => await UpdateTimestampAsync(context), heartbeatInterval, loggerFactory);
|
||||
|
|
|
|||
|
|
@ -21,7 +21,7 @@ public class RuntimeOptions
|
|||
/// A separate heartbeat process will ensure the <see cref="WorkflowInstance.UpdatedAt"/> is updated before this threshold.
|
||||
/// If the workflow instance got removed from memory, e.g. because of an application shutdown, the LastUpdated field will eventually exceed the liveness threshold and therefore be considered to be interrupted.
|
||||
/// </remarks>
|
||||
public TimeSpan WorkflowLivenessThreshold { get; set; } = TimeSpan.FromMinutes(5);
|
||||
public TimeSpan InactivityThreshold { get; set; } = TimeSpan.FromMinutes(5);
|
||||
|
||||
/// <summary>
|
||||
/// The number of workflow instances to restart in a single batch.
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@ public class RestartInterruptedWorkflowsTask(
|
|||
|
||||
private WorkflowInstanceFilter CreateWorkflowInstanceFilter()
|
||||
{
|
||||
var livenessThreshold = options.Value.WorkflowLivenessThreshold;
|
||||
var livenessThreshold = options.Value.InactivityThreshold;
|
||||
var now = systemClock.UtcNow;
|
||||
var cutoffTimestamp = now - livenessThreshold;
|
||||
return new()
|
||||
|
|
|
|||
Loading…
Reference in a new issue