Files
ScadaBridge/src/ZB.MOM.WW.ScadaBridge.SiteRuntime/SiteRuntimeOptions.cs
T
Joseph Doherty 605e56829e chore(config): retire ReplicationEnabled, make legacy db paths migration-only
LocalDb Phase 2 deleted the bespoke replicators, so three config keys changed
meaning or died outright:

- ScadaBridge:StoreAndForward:ReplicationEnabled is fully dead. Deleted the
  property, its 10 config entries, and the 5 test references.
- SqliteDbPath / SiteDbPath are now migration-only: they name the legacy files
  SiteLocalDbLegacyMigrator drains at boot, not live databases. Both mandatory
  rules are relaxed accordingly (StartupValidator's Site-only Require, and the
  S&F validator's non-empty rule) — an absent value now means "nothing to
  migrate", so an already-migrated node can drop the key. DatabaseOptions-
  Validator still rejects a present-but-blank value.
- SiteRuntime:ConfigFetchRetryCount's only reader was SiteReplicationActor.
  Deleted with its validator rule.

The two path keys stay present in every config, now with a comment explaining
why: removing them would strand un-migrated data on a node that has not yet
started once.

Both relaxations are pinned by the inverse of the test they replace
(Site_MissingSiteDbPath_IsAccepted..., EmptySqliteDbPath_IsAccepted...), each
verified to fail with the old rule restored.

Note: deploy/wonder-app-vd03/appsettings.Site.json is under a gitignored
deploy/ tree, so its edit is local-only and must be repeated on the box.

Claude-Session: https://claude.ai/code/session_01BL2Vu1ESDQ9SCN4gVKkdts
2026-07-20 04:35:11 -04:00

81 lines
3.1 KiB
C#

namespace ZB.MOM.WW.ScadaBridge.SiteRuntime;
/// <summary>
/// Configuration options for the Site Runtime component.
/// Bound from ScadaBridge:SiteRuntime configuration section.
/// </summary>
public class SiteRuntimeOptions
{
/// <summary>
/// Number of Instance Actors to create per batch during staggered startup.
/// Default: 20.
/// </summary>
public int StartupBatchSize { get; set; } = 20;
/// <summary>
/// Delay in milliseconds between startup batches to prevent reconnection storms.
/// Default: 100ms.
/// </summary>
public int StartupBatchDelayMs { get; set; } = 100;
/// <summary>
/// Maximum call depth for recursive script calls (CallScript/CallShared).
/// Default: 10.
/// </summary>
public int MaxScriptCallDepth { get; set; } = 10;
/// <summary>
/// Default script execution timeout in seconds.
/// Default: 30 seconds.
/// </summary>
public int ScriptExecutionTimeoutSeconds { get; set; } = 30;
/// <summary>
/// Per-subscriber buffer size for the site-wide Akka stream.
/// Slow subscribers drop oldest messages when buffer is full.
/// Default: 1000.
/// </summary>
public int StreamBufferSize { get; set; } = 1000;
/// <summary>
/// Number of dedicated threads in the script-execution scheduler.
/// Script and alarm on-trigger bodies run on these threads instead of the shared
/// .NET thread pool, so blocking script I/O cannot starve the global pool.
/// Default: 8.
/// </summary>
public int ScriptExecutionThreadCount { get; set; } = 8;
/// <summary>
/// Max mirrored native alarms retained per source binding before older entries are dropped (logged).
/// Default: 1000.
/// </summary>
public int MirroredAlarmCapPerSource { get; set; } = 1000;
/// <summary>
/// Interval in milliseconds to retry a failed native alarm subscription.
/// Default: 5000ms.
/// </summary>
public int NativeAlarmRetryIntervalMs { get; set; } = 5000;
/// <summary>HTTP timeout (seconds) for fetching a deployment config from central (notify-and-fetch).</summary>
public int ConfigFetchTimeoutSeconds { get; set; } = 30;
/// <summary>
/// Fixed interval (ms) at which an Instance Actor re-sends a tag-subscribe
/// request that either failed or whose response was lost (S4/UA6). The retry is
/// armed on every send and cancelled on the first Success reply, so it closes
/// both the failed-response and the lost-response gaps. Default: 5000ms.
/// </summary>
public int TagSubscribeRetryIntervalMs { get; set; } = 5000;
/// <summary>
/// Grace period (ms) after a script's execution timeout elapses before the
/// stuck-script watchdog declares the script's dedicated thread blocked and
/// emits a loud site event naming it (S2). The CTS timeout only requests
/// cooperative cancellation; a script blocked in synchronous I/O never
/// observes it, so this watchdog is the only operator signal that one of the
/// bounded script-execution threads is gone. Default: 30000ms.
/// </summary>
public int StuckScriptGraceMs { get; set; } = 30000;
}