diag: log slow QSO inserts (>2s) with call/band/mode; rotate the app log to .1 at 10MB instead of deleting it, so the previous session's diagnostics survive
This commit is contained in:
@@ -1934,7 +1934,13 @@ func (a *App) AddQSO(q qso.QSO) (id int64, err error) {
|
||||
// was redundant with the entry lookup and only slowed logging (a call not yet in
|
||||
// the cache made AddQSO wait on QRZ/HamQTH). If the entry lookup hadn't finished
|
||||
// when you logged (fast CW: type → Enter), the e-mail is simply blank — fine.
|
||||
insT0 := time.Now()
|
||||
id, err = a.qso.Add(a.ctx, q)
|
||||
if d := time.Since(insT0); d > 2*time.Second {
|
||||
// Surface a genuinely slow INSERT (DB lock / overloaded server) — this is the
|
||||
// value we need when someone reports "logging took N seconds".
|
||||
applog.Printf("log: SLOW qso insert took %s (call=%s band=%s mode=%s)", d.Round(time.Millisecond), q.Callsign, q.Band, q.Mode)
|
||||
}
|
||||
if err != nil && db.IsConnLost(err) {
|
||||
// The database is UNREACHABLE (not a data error) — park the QSO in the
|
||||
// offline outbox rather than lose it. Returns id = -1 so the UI can say
|
||||
|
||||
Reference in New Issue
Block a user