From ad94a6aff4337bcd8cce0b8898644d7e064ecbfe Mon Sep 17 00:00:00 2001 From: Anders McCarthy Date: Mon, 15 Jan 2024 12:05:23 +0100 Subject: [PATCH] Fix collection initialization (#2) --- collection.go | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/collection.go b/collection.go index b950adc..80b9f98 100644 --- a/collection.go +++ b/collection.go @@ -47,6 +47,11 @@ func (c *Collection) Add(s Service) { c.services = append(c.services, s) s.Subscribe(c.id, c.updates) + + // Trigger an update to include the state of the newly added service. + go func() { + c.updates <- Notification{} + }() } // StateCount returns the number of monitored services currently in the given state.