Add enabled parameter to service (#175)

* feat: Add enabled flag to service
* Add IsEnabled method

Co-authored-by: 1newsr <1newsr@users.noreply.github.com>
This commit is contained in:
newsr
2021-09-18 11:52:11 -04:00
committed by GitHub
co-authored by 1newsr
parent d6b4c2394a
commit 9bd5c38a96
4 changed files with 29 additions and 3 deletions
+5 -3
View File
@@ -26,9 +26,11 @@ var (
func Monitor(cfg *config.Config) {
ctx, cancelFunc = context.WithCancel(context.Background())
for _, service := range cfg.Services {
// To prevent multiple requests from running at the same time, we'll wait for a little bit before each iteration
time.Sleep(1111 * time.Millisecond)
go monitor(service, cfg.Alerting, cfg.DisableMonitoringLock, cfg.Metrics, cfg.Debug, ctx)
if service.IsEnabled() {
// To prevent multiple requests from running at the same time, we'll wait for a little bit before each iteration
time.Sleep(1111 * time.Millisecond)
go monitor(service, cfg.Alerting, cfg.DisableMonitoringLock, cfg.Metrics, cfg.Debug, ctx)
}
}
}