mDNS discovery starts announcing right away: does not wait for first interval to elapse.
Closes
@@ -118,8 +118,7 @@ func (m *mdnsService) pollForEntries(ctx context.Context) {
ticker := time.NewTicker(m.interval)
for {
- select {
- case <-ticker.C:
+ //execute mdns query right away at method call and then with every tick
entriesCh := make(chan *mdns.ServiceEntry, 16)
go func() {
for entry := range entriesCh {
@@ -141,6 +140,10 @@ func (m *mdnsService) pollForEntries(ctx context.Context) {
}
close(entriesCh)
log.Debug("mdns query complete")
+
+ select {
+ case <-ticker.C:
+ continue
case <-ctx.Done():
log.Debug("mdns service halting")
return
