chore: release v0.21.3
This commit is contained in:
@@ -649,15 +649,29 @@ func (m *Manager) run(b Backend, stop, done chan struct{}, cmds chan func(), pol
|
||||
const reconnectEvery = 5 * time.Second
|
||||
connected := false
|
||||
var lastAttempt time.Time
|
||||
var lastConnErr string // last connect failure logged, so the retry loop says it once
|
||||
tryConnect := func() {
|
||||
if connected || time.Since(lastAttempt) < reconnectEvery {
|
||||
return
|
||||
}
|
||||
lastAttempt = time.Now()
|
||||
if err := b.Connect(); err != nil {
|
||||
// Log it — the message used to live only in RigState.Error, i.e. in a
|
||||
// tooltip. The status pill condenses everything to "OmniRig not found",
|
||||
// so a user reporting that had no way to tell us WHY: the COM HRESULT,
|
||||
// the serial error, the refused TCP connect, all invisible. Logged once
|
||||
// per distinct message so the retry loop doesn't flood the file.
|
||||
if msg := err.Error(); msg != lastConnErr {
|
||||
lastConnErr = msg
|
||||
debugLog.Printf("%s connect failed: %s", b.Name(), msg)
|
||||
}
|
||||
m.update(RigState{Enabled: true, Backend: b.Name(), Connected: false, Error: err.Error(), UpdatedAt: time.Now()})
|
||||
return
|
||||
}
|
||||
if lastConnErr != "" {
|
||||
debugLog.Printf("%s connected (after: %s)", b.Name(), lastConnErr)
|
||||
lastConnErr = ""
|
||||
}
|
||||
connected = true
|
||||
}
|
||||
tryConnect()
|
||||
|
||||
Reference in New Issue
Block a user