From 7795e134328101e6491c9c90bf87a6d4a8adb411 Mon Sep 17 00:00:00 2001 From: rouggy Date: Sat, 29 Aug 2026 01:28:50 +0200 Subject: [PATCH] fix(watchlist): open the store before the logbook connect MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit It was created after the (possibly remote) logbook connect, so a 10-30 s MySQL dial left the tab saying 'Watchlist: 0' until the next refresh tick — twenty seconds of an empty list for a JSON file that reads in a millisecond. It now opens right after the data dir is known; only the auto-contest pattern waits for the settings store. --- app.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/app.go b/app.go index c11a9cf..56c69e5 100644 --- a/app.go +++ b/app.go @@ -1021,6 +1021,13 @@ func (a *App) startup(ctx context.Context) { return } a.dataDir = dataDir + // The watchlist needs nothing but its file, so it opens FIRST. It used to be + // created after the logbook connect, and a remote MySQL dial of 10-30 s left + // the tab saying "Watchlist: 0" until the next refresh tick — twenty seconds + // of an empty list for a JSON file that reads in a millisecond. (The + // auto-contest pattern still loads later, once the settings store is open.) + a.watchlist = watchlist.New(filepath.Join(dataDir, "watchlist.json")) + a.watchAlertAt = map[string]time.Time{} // Settings/config database (settings + profiles). Fresh installs use // settings.db; existing installs keep their opslog.db (which also held the // QSOs before they were split into a dedicated logbook file — see below). @@ -1391,8 +1398,6 @@ func (a *App) startup(ctx context.Context) { // POTA: background poller of api.pota.app so cluster spots can be tagged // when the DX station is currently activating a park. Best-effort. a.pota = pota.New(func(format string, args ...any) { applog.Printf(format, args...) }) - a.watchlist = watchlist.New(filepath.Join(a.dataDir, "watchlist.json")) - a.watchAlertAt = map[string]time.Time{} a.watchPattern.Store(strings.ToUpper(strings.TrimSpace(a.settingOr(keyWatchlistContestPattern, "")))) go a.pota.Run(a.ctx)