WIP: improve responsiveness.

This commit is contained in:
jdl
2026-06-15 17:59:25 +02:00
parent fa933ae029
commit 802ca9aba4
3 changed files with 21 additions and 10 deletions

View File

@@ -78,8 +78,8 @@ func (a *App) Run() error {
// while we were down).
a.updateHosts()
ticker := time.NewTicker(PingInterval)
defer ticker.Stop()
stateTicker := time.NewTicker(time.Second) // TODO: Const.
pingTicker := time.NewTicker(PingInterval)
sig := make(chan os.Signal, 1)
signal.Notify(sig, syscall.SIGTERM, syscall.SIGINT)
@@ -97,10 +97,12 @@ func (a *App) Run() error {
a.onPing(e)
case e := <-a.multicastCh:
a.onMulticastDiscovery(e)
case <-ticker.C:
case <-stateTicker.C:
a.onTick()
case <-pingTicker.C:
a.onPingTicker()
tickCount++
if tickCount%8 == 0 {
if tickCount == 0 {
a.logNetworkState()
}