HeartbeatService.Start() always returned early because running() checked stopChan closure state, which is "open" (= true) for a newly created service. This caused Start() to interpret a fresh service as "already running" and skip launching the goroutine. Introduce a `started` bool field to separate "has been started" from "has not been stopped", fixing both the start failure and a potential double-close panic on Stop().
2.6 KiB
2.6 KiB