Interface IEnvironmentChangeHandler
- Namespace
- IntentSharp.ChangeDetection
- Assembly
- IntentSharp.dll
Acts on a change the client found in its environment, such as recompiling the rules written for a target whose
schema changed. Register one with AddEnvironmentChangeHandler(IEnvironmentChangeHandler), or in dependency
injection as an IEnvironmentChangeHandler for a client built by AddIntentSharp.
public interface IEnvironmentChangeHandler
- Extension Methods
Remarks
The client runs the handlers of a change one after another, in the order they were added, before the operation that
found the change continues, and each under the environment.handlerTimeout setting (one minute by default). A
handler past the timeout is abandoned: its token is cancelled, the operation goes on under whatever version runs,
and the operation's Maintenance names it as a problem. Work an abandoned handler
goes on with is no longer part of the change: a change it raises or an operation it starts waits its turn like any
other. A handler that throws is logged and reported the same way; the next handler still runs.
A change is handled by one process: when several processes share a document store, the first to record a new
fingerprint runs the handlers and the others do not. Report model calls with
ReportMaintenance(AIResultBase) and work left undone with
ReportPending(string, string?); take TryTakeRecompileAsync(string, string, CancellationToken)
before each recompile, so environment.maxRecompilesPerHour applies. Members added in later versions have
default bodies, so a handler written today keeps compiling.