From 9218aa2263643b72eb6574dc221432de2bb68e1b Mon Sep 17 00:00:00 2001 From: David Newhall II Date: Sat, 4 Nov 2023 14:42:36 -0700 Subject: [PATCH] fix service count toast --- pkg/client/tray.go | 4 ++-- pkg/services/services.go | 5 +++++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/pkg/client/tray.go b/pkg/client/tray.go index d65a5dead..99faec956 100644 --- a/pkg/client/tray.go +++ b/pkg/client/tray.go @@ -272,7 +272,7 @@ func (c *Client) notifiarrMenuActions() { menu["syncqp"].Click(func() { c.triggers.CFSync.SyncSonarrRP(website.EventUser) }) menu["svcs_prod"].Click(func() { c.Print("[user requested] Checking services and sending results to Notifiarr.") - ui.Notify("Running and sending %d Service Checks.", len(c.Config.Service)) + ui.Notify("Running and sending %d Service Checks.", c.Config.Services.SvcCount()) c.Config.Services.RunChecks(website.EventUser) }) menu["plex_prod"].Click(func() { c.triggers.PlexCron.Send(website.EventUser) }) @@ -323,7 +323,7 @@ func (c *Client) debugMenu() { menu["svcs_log"] = debug.AddSubMenuItem("Log Service Checks", "check all services and log results") menu["svcs_log"].Click(func() { c.Print("[user requested] Checking services and logging results.") - ui.Notify("Running and logging %d Service Checks.", len(c.Config.Service)) + ui.Notify("Running and logging %d Service Checks.", c.Config.Services.SvcCount()) c.Config.Services.RunChecks("log") }) diff --git a/pkg/services/services.go b/pkg/services/services.go index 65d8ccc26..a885f013e 100644 --- a/pkg/services/services.go +++ b/pkg/services/services.go @@ -234,3 +234,8 @@ func (c *Config) Stop() { c.done = nil c.stopChan = nil } + +// SvcCount returns the count of services being monitored. +func (c *Config) SvcCount() int { + return len(c.services) +}