Table of Contents

Class OutageScheduleEvaluator

Namespace
SEBT.Portal.Infrastructure.Services
Assembly
SEBT.Portal.Infrastructure.dll

Evaluates the configured OutageScheduleSettings against the current time so the outage page can auto-enable during scheduled (state-backend) maintenance windows without a manual flag toggle. Windows apply per-surface via Target. Reads the schedule via Microsoft.Extensions.Options.IOptionsMonitor<TOptions> so AWS AppConfig updates take effect without a redeploy.

Startup validation rejects an unknown timezone, an unparseable window, and an unrecognized target, so none of those should reach this class. The checks below remain as a backstop and log at Error: reaching one means validation was bypassed, and the feature-flag endpoints must keep answering either way. Both methods share OutageWindowParsing with the validator, so their notion of a well-formed window cannot drift apart.

public sealed class OutageScheduleEvaluator : IOutageScheduleEvaluator
Inheritance
object
OutageScheduleEvaluator
Implements

Constructors

OutageScheduleEvaluator(IOptionsMonitor<OutageScheduleSettings>, TimeProvider, ILogger<OutageScheduleEvaluator>)

public OutageScheduleEvaluator(IOptionsMonitor<OutageScheduleSettings> options, TimeProvider timeProvider, ILogger<OutageScheduleEvaluator> logger)

Parameters

options IOptionsMonitor<OutageScheduleSettings>
timeProvider TimeProvider
logger ILogger<OutageScheduleEvaluator>

Methods

HasScheduledWindows(OutageTarget)

Returns true when any configured window applies to surface, regardless of whether its Start/End parse or whether it is currently active. Callers use this to decide whether the schedule (rather than a manual feature flag) is the authority for that surface. Windows with an unrecognized Target are excluded — a window skipped during evaluation must not silently lock out the manual toggle.

public bool HasScheduledWindows(OutageTarget surface)

Parameters

surface OutageTarget

Returns

bool

IsOutageActive(OutageTarget)

Returns true when "now" is inside any configured outage window that applies to surface (its Target is that surface or "Both"). Never throws — missing or invalid configuration is treated as "no scheduled outage" (false).

public bool IsOutageActive(OutageTarget surface)

Parameters

surface OutageTarget

Returns

bool