Merge branch 'fix/archreview-crit2-vt-timeout'

This commit is contained in:
Joseph Doherty
2026-07-09 06:07:33 -04:00
5 changed files with 149 additions and 17 deletions
@@ -0,0 +1,20 @@
namespace ZB.MOM.WW.OtOpcUa.Commons.Engines;
/// <summary>
/// Optional capability an <see cref="IVirtualTagEvaluator"/> may implement when it caches
/// compiled scripts and needs an apply-boundary drop. The production
/// <c>RoslynVirtualTagEvaluator</c> caches one collectible
/// <see cref="System.Runtime.Loader.AssemblyLoadContext"/> per compiled expression; without a
/// drop on each config-apply generation those ALCs accrete forever across script edits (every
/// republish roots a new one). <c>VirtualTagHostActor</c> casts its injected evaluator to this
/// interface and calls <see cref="ClearCompiledScripts"/> at each apply so stale ALCs are
/// reclaimed — mirroring how <c>ScriptedAlarmEngine</c> clears its compile cache per generation.
/// Evaluators with no cache (e.g. <see cref="NullVirtualTagEvaluator"/>) simply don't implement
/// it, and the host actor's null-conditional cast makes the call a no-op.
/// </summary>
public interface IScriptCacheOwner
{
/// <summary>Drops every cached compiled script, disposing each so its collectible
/// AssemblyLoadContext unloads. Called at each config-apply generation boundary.</summary>
void ClearCompiledScripts();
}