Skip to content

Extract monitor execution boilerplate into VirtualClientMonitorComponent#665

Open
AlexW-F wants to merge 1 commit intomainfrom
users/alexwill/virtualclientmonitor
Open

Extract monitor execution boilerplate into VirtualClientMonitorComponent#665
AlexW-F wants to merge 1 commit intomainfrom
users/alexwill/virtualclientmonitor

Conversation

@AlexW-F
Copy link
Copy Markdown
Contributor

@AlexW-F AlexW-F commented Mar 27, 2026

Move the iteration/strategy/frequency execution loop from ExecuteCommandMonitor.ExecuteAsync into the base class ExecuteMonitorOnIntervalAsync method. Subclasses now only need to override ExecuteMonitorAsync with their specific monitor logic.

VirtualClientMonitorComponent changes:

  • Implement ExecuteMonitorOnIntervalAsync with iteration tracking, MonitorStrategy (Once, OnceAtBeginAndEnd), MonitorIterations, and MonitorFrequency interval support
  • Guard nullable property getters (MonitorFrequency, MonitorIterations, MonitorWarmupPeriod) with ContainsKey to return null instead of throwing when the parameter is absent
  • Remove conditional in ExecuteAsync so the interval method is always called when the monitor is enabled

ExecuteCommandMonitor changes:

  • Change base class from VirtualClientIntervalBasedMonitor to VirtualClientMonitorComponent
  • Replace ExecuteAsync override with ExecuteMonitorAsync containing only the command execution logic
  • Remove duplicated boilerplate (warmup, iteration loop, strategy handling, error catching)

Move the iteration/strategy/frequency execution loop from
ExecuteCommandMonitor.ExecuteAsync into the base class
ExecuteMonitorOnIntervalAsync method. Subclasses now only need to
override ExecuteMonitorAsync with their specific monitor logic.

VirtualClientMonitorComponent changes:
- Implement ExecuteMonitorOnIntervalAsync with iteration tracking,
  MonitorStrategy (Once, OnceAtBeginAndEnd), MonitorIterations, and
  MonitorFrequency interval support
- Guard nullable property getters (MonitorFrequency, MonitorIterations,
  MonitorWarmupPeriod) with ContainsKey to return null instead of
  throwing when the parameter is absent
- Remove conditional in ExecuteAsync so the interval method is always
  called when the monitor is enabled

ExecuteCommandMonitor changes:
- Change base class from VirtualClientIntervalBasedMonitor to
  VirtualClientMonitorComponent
- Replace ExecuteAsync override with ExecuteMonitorAsync containing
  only the command execution logic
- Remove duplicated boilerplate (warmup, iteration loop, strategy
  handling, error catching)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant