From d7c0135d0ba950ed6a7dbec3dedc17142aeeabd4 Mon Sep 17 00:00:00 2001 From: Joseph Doherty Date: Thu, 22 Oct 2026 15:15:49 -0400 Subject: [PATCH] docs(scripting): ctx.CancellationToken also fires on caller cancellation Review m-6. The XML doc said the token is cancelled on timeout only. ScriptRunGuard links it to the caller's token (CreateLinkedTokenSource(ct)), so it is also cancelled on shutdown or when the evaluating actor stops mid-run. The doc now says so. Refs #731 #734 Claude-Session: https://claude.ai/code/session_01Ub9hGmYLQvn9XETzw7CMsT --- .../ScriptContext.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Core/ZB.MOM.WW.OtOpcUa.Core.Scripting.Abstractions/ScriptContext.cs b/src/Core/ZB.MOM.WW.OtOpcUa.Core.Scripting.Abstractions/ScriptContext.cs index e293ff98..b4fdf3cd 100644 --- a/src/Core/ZB.MOM.WW.OtOpcUa.Core.Scripting.Abstractions/ScriptContext.cs +++ b/src/Core/ZB.MOM.WW.OtOpcUa.Core.Scripting.Abstractions/ScriptContext.cs @@ -82,7 +82,8 @@ public abstract class ScriptContext /// /// The current run's cancellation token. The run guard cancels it when the run exceeds its wall-clock - /// budget, so a long-running script can poll ctx.CancellationToken.IsCancellationRequested (or call + /// budget, and it is linked to the caller's token, so it is also cancelled when the caller cancels (host + /// shutdown, an actor stopping mid-run). A long-running script can poll ctx.CancellationToken.IsCancellationRequested (or call /// ThrowIfCancellationRequested()) and end its own abandoned run instead of holding a pool thread /// until it returns. Cooperative only: a script that never looks at it still runs to completion as an /// orphan. outside a run.