perf(runtime): split trigger evals from the blocking pool; bounded, deadline-aware execution

This commit is contained in:
Joseph Doherty
2026-08-14 22:36:15 -04:00
parent 312216ff2b
commit c4fc1f8ecd
42 changed files with 3673 additions and 1251 deletions
@@ -25,6 +25,20 @@ public interface ISiteHealthCollector
/// </summary>
void IncrementDeadLetter();
/// <summary>
/// WP3.1: increments the per-interval count of script/alarm runs SHED because
/// <c>MaxConcurrentRunsPerScript</c> runs were already in flight for that script. A raw
/// per-interval count like the script/alarm error counters — a sustained non-zero value
/// means a trigger is firing faster than its script can complete. Every shed is counted
/// here even when its accompanying site event is rate-limited away.
/// Default interface implementation is a no-op so existing test fakes continue to
/// compile without per-fake updates.
/// </summary>
void IncrementScriptRunShed()
{
// Default no-op so test fakes do not need to be updated.
}
/// <summary>
/// Increment the per-interval count of
/// <c>FallbackAuditWriter</c> primary failures. Bridged from the
@@ -173,7 +187,13 @@ public interface ISiteHealthCollector
/// <param name="queueDepth">Script tasks waiting to run.</param>
/// <param name="busyThreads">Worker threads currently executing a script.</param>
/// <param name="oldestBusyAgeSeconds">Age (seconds) of the oldest in-flight script, or <c>null</c> when idle.</param>
void SetScriptSchedulerStats(int queueDepth, int busyThreads, double? oldestBusyAgeSeconds)
/// <param name="detachedThreads">
/// WP3.1: worker threads the stuck-script watchdog has detached and replaced because
/// their script wedged past its deadline plus grace, and which have not yet returned.
/// A non-zero, non-draining value means script bodies are permanently blocking threads.
/// </param>
void SetScriptSchedulerStats(
int queueDepth, int busyThreads, double? oldestBusyAgeSeconds, int detachedThreads = 0)
{
// Default no-op so test fakes do not need to be updated.
}