fix(watchlist): open the store before the logbook connect
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.
This commit is contained in:
@@ -1021,6 +1021,13 @@ func (a *App) startup(ctx context.Context) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
a.dataDir = dataDir
|
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/config database (settings + profiles). Fresh installs use
|
||||||
// settings.db; existing installs keep their opslog.db (which also held the
|
// settings.db; existing installs keep their opslog.db (which also held the
|
||||||
// QSOs before they were split into a dedicated logbook file — see below).
|
// 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
|
// POTA: background poller of api.pota.app so cluster spots can be tagged
|
||||||
// when the DX station is currently activating a park. Best-effort.
|
// 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.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, ""))))
|
a.watchPattern.Store(strings.ToUpper(strings.TrimSpace(a.settingOr(keyWatchlistContestPattern, ""))))
|
||||||
go a.pota.Run(a.ctx)
|
go a.pota.Run(a.ctx)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user