fix: UDP-logged QSOs fall back to the offline outbox on DB failure (were silently lost); speed up MySQL connect (batch migration checks into 1 query, connect direct-to-DB first) — was ~40s on a high-latency link

This commit is contained in:
2026-07-21 11:18:36 +02:00
parent 3e9ebdb89a
commit d9b7e48e83
3 changed files with 51 additions and 12 deletions
+12
View File
@@ -9623,6 +9623,14 @@ func (a *App) LogUDPLoggedADIF(adifText string) (int64, error) {
id, err := a.qso.Add(a.ctx, q)
if err != nil {
// DB UNREACHABLE (drop / timeout on a slow-or-broken MySQL) — park the QSO
// in the offline outbox rather than lose it, exactly like the manual log
// path. Without this, a laggy shared MySQL silently dropped UDP-logged QSOs
// from a multi-stream MSHV. Returns -1 so the caller treats it as "saved,
// waiting to sync", not a failure.
if db.IsConnLost(err) && a.queueOffline(q, err) {
return -1, nil
}
return 0, fmt.Errorf("insert qso: %w", err)
}
q.ID = id
@@ -9633,6 +9641,10 @@ func (a *App) LogUDPLoggedADIF(adifText string) (int64, error) {
a.extsvc.OnQSOLogged(id)
}
a.maybeAutoSendEQSL(q)
// A successful write means the link is healthy again — flush anything parked.
if a.offlineMode && a.offlineQ != nil && a.offlineQ.Count() > 0 {
go func() { _, _ = a.replayOfflineQueue() }()
}
return id, nil
}