Skip to content

[Code Quality] MonitoringViewModels — OnTick guard + timer pattern triplicated across 3 ViewModels #517

@Christophe-Rogiers

Description

@Christophe-Rogiers

Severity: Warning

Files:

  • src/Servy.Manager/ViewModels/PerformanceViewModel.cs, lines 263–291
  • src/Servy.Manager/ViewModels/ConsoleViewModel.cs, lines 459–483
  • src/Servy.Manager/ViewModels/DependenciesViewModel.cs, lines 260–284

Description:
Identical pattern triplicated: Interlocked.CompareExchange guard, _timer?.Stop(), try/finally restart, InitTimer, StartMonitoring, StopMonitoring, and Cleanup. Changes to the tick lifecycle logic must be applied in three places.

Suggested fix:
Extract abstract MonitoringViewModelBase : ViewModelBase with the shared plumbing and an abstract OnTickAsync() method.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions