From 0c2eb74243d8eeea40aa28c8156e86ed8e66bb73 Mon Sep 17 00:00:00 2001 From: intergrav Date: Sun, 28 Jun 2026 23:13:11 -0400 Subject: [PATCH] fix: attempt recover connection when unreachable --- tray.go | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tray.go b/tray.go index 053c55e..0490da0 100644 --- a/tray.go +++ b/tray.go @@ -99,6 +99,24 @@ func anyError() bool { return false } +func unreachableRecovered(cfg Config) bool { + profileMu.Lock() + var unreachable []int + for i, p := range profileStates { + if p.errMsg == "" && p.repoErr != "" { + unreachable = append(unreachable, i) + } + } + profileMu.Unlock() + + for _, i := range unreachable { + if i < len(cfg.Profile) && repoStatus(cfg.Profile[i]).errMsg == "" { + return true + } + } + return false +} + func onReady() { firstLaunch := !fileExists(configPath()) setIconAnimated("idle") @@ -449,7 +467,7 @@ func onReady() { profileItems[i].Show() } - if ps.errMsg == "" && ps.repoErr == "" && prof.Schedule.Cron != "" { + if ps.errMsg == "" && prof.Schedule.Cron != "" { idx := i eid, err := sched.AddFunc(prof.Schedule.Cron, func() { current := loadConfig() @@ -550,6 +568,12 @@ func onReady() { continue } } + + if !isAnyBusy() && unreachableRecovered(loadConfig()) { + applyConfig() + continue + } + updateAllStatusItems(loadConfig()) } }() -- 2.51.2