fix: Auto download Lotw user list at launch
This commit is contained in:
@@ -50,6 +50,17 @@ func (m *Manager) Info() (date string, count int) {
|
||||
return m.db.Date(), m.db.Count()
|
||||
}
|
||||
|
||||
// NeedsRefresh reports whether the cached country file is missing or older than
|
||||
// maxAge — so the caller re-downloads it to pick up newly-added date-ranged
|
||||
// exceptions (e.g. an event call's fresh SARDINIA period).
|
||||
func (m *Manager) NeedsRefresh(maxAge time.Duration) bool {
|
||||
fi, err := os.Stat(m.Path())
|
||||
if err != nil {
|
||||
return true // missing
|
||||
}
|
||||
return time.Since(fi.ModTime()) > maxAge
|
||||
}
|
||||
|
||||
// EnsureLoaded loads the cached file into memory if present. Does NOT download.
|
||||
func (m *Manager) EnsureLoaded() error {
|
||||
if m.Loaded() {
|
||||
|
||||
Reference in New Issue
Block a user