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:
newsrand1newsr authored and GitHub committed 2021-09-18 11:52:11 -04:00
1 parent d6b4c2394a
commit 9bd5c38a96
4 files changed
+29 -3

No files matched your search

+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)
}
}
}