detached 5c17705

fix(filtering): skip update check if last check was within 24 hours

commit
5c17705d8ddcd9f4dae0f353edcdb0c7ad7212b9
author
bnema · · 2025-11-29 15:58 UTC
parent
07d6e36
signature
unsigned
3 files · +13 -0
M internal/filtering/manager.go +1 -0
@@ -48,6 +48,7 @@ type FilterStore interface {
4848 GetCacheInfo() (bool, time.Time, error)
4949 GetSourceVersion(url string) string
5050 SetSourceVersion(url string, version string) error
51+ GetLastCheckTime() time.Time
5152 }
5253
5354 // FilterCompiler defines the interface for filter compilation
@@ -48,6 +48,7 @@ type FilterStore interface {
48 GetCacheInfo() (bool, time.Time, error)48 GetCacheInfo() (bool, time.Time, error)
49 GetSourceVersion(url string) string49 GetSourceVersion(url string) string
50 SetSourceVersion(url string, version string) error50 SetSourceVersion(url string, version string) error
51+ GetLastCheckTime() time.Time
51 }52 }
52 53
53 // FilterCompiler defines the interface for filter compilation54 // FilterCompiler defines the interface for filter compilation
M internal/filtering/updater.go +7 -0
@@ -67,6 +67,13 @@ func (fu *FilterUpdater) CheckAndUpdate(ctx context.Context) error {
6767 fu.updateMutex.Lock()
6868 defer fu.updateMutex.Unlock()
6969
70+ // Skip if we checked within the last 24 hours
71+ lastCheck := fu.manager.store.GetLastCheckTime()
72+ if !lastCheck.IsZero() && time.Since(lastCheck) < 24*time.Hour {
73+ logging.Info(fmt.Sprintf("[filtering] Skipping update check, last check was %v ago", time.Since(lastCheck).Round(time.Minute)))
74+ return nil
75+ }
76+
7077 startTime := time.Now()
7178 logging.Info("[filtering] Starting filter list update check...")
7279
@@ -67,6 +67,13 @@ func (fu *FilterUpdater) CheckAndUpdate(ctx context.Context) error {
67 fu.updateMutex.Lock()67 fu.updateMutex.Lock()
68 defer fu.updateMutex.Unlock()68 defer fu.updateMutex.Unlock()
69 69
70+ // Skip if we checked within the last 24 hours
71+ lastCheck := fu.manager.store.GetLastCheckTime()
72+ if !lastCheck.IsZero() && time.Since(lastCheck) < 24*time.Hour {
73+ logging.Info(fmt.Sprintf("[filtering] Skipping update check, last check was %v ago", time.Since(lastCheck).Round(time.Minute)))
74+ return nil
75+ }
76+
70 startTime := time.Now()77 startTime := time.Now()
71 logging.Info("[filtering] Starting filter list update check...")78 logging.Info("[filtering] Starting filter list update check...")
72 79
M internal/filtering/updater_test.go +5 -0
@@ -158,6 +158,7 @@ type mockFilterStore struct {
158158 cachedFilters *CompiledFilters
159159 cacheExists bool
160160 cacheModTime time.Time
161+ lastCheckTime time.Time
161162 }
162163
163164 func (m *mockFilterStore) LoadCached() (*CompiledFilters, error) {
@@ -187,3 +188,7 @@ func (m *mockFilterStore) SetSourceVersion(url string, version string) error {
187188 m.sourceVersions[url] = version
188189 return nil
189190 }
191+
192+func (m *mockFilterStore) GetLastCheckTime() time.Time {
193+ return m.lastCheckTime
194+}
@@ -158,6 +158,7 @@ type mockFilterStore struct {
158 cachedFilters *CompiledFilters158 cachedFilters *CompiledFilters
159 cacheExists bool159 cacheExists bool
160 cacheModTime time.Time160 cacheModTime time.Time
161+ lastCheckTime time.Time
161 }162 }
162 163
163 func (m *mockFilterStore) LoadCached() (*CompiledFilters, error) {164 func (m *mockFilterStore) LoadCached() (*CompiledFilters, error) {
@@ -187,3 +188,7 @@ func (m *mockFilterStore) SetSourceVersion(url string, version string) error {
187 m.sourceVersions[url] = version188 m.sourceVersions[url] = version
188 return nil189 return nil
189 }190 }
191+
192+func (m *mockFilterStore) GetLastCheckTime() time.Time {
193+ return m.lastCheckTime
194+}

Keyboard shortcuts

Single-key shortcuts are on. ctrl k and esc work whatever this says.

ctrl k :
go to a section, branch, tag, file or repository
?
this list
j k
move the row cursor down / up
enter
open the row under the cursor; on Files, a directory opens or closes in place
↑ ↓ ← → home end
in the file tree (focus on a row): previous / next row, close / open a directory or go to its parent / first entry, first / last row. They never open a file
l h
on Files: open a directory or a file / close a directory or go up to its parent, then to the parent page. Elsewhere: into the side panel (on a merge request, its files) / back to the content; there j k move between its controls
g g G
first / last row
/
filter the list; on Files, find a file anywhere in the repository (esc clears, enter opens the best match)
b
switch branch or tag
g s g f g c g b g m g i g r g a
tabs: summary, files, commits, branches & tags, merge requests, issues, releases, actions (when available)
g h
home
w
wide mode: use the whole width of the screen, or not (remembered)
y
copy a permalink pinned to the commit
d u x
diff: split / unified / collapse or expand all
e E
diff: the whole file in view / every file, with the lines the hunks hide
n
merge request: next note in the diff
esc
close a dialog, leave a field

Branches 8

Tags 42

↑↓ moveenter openesc close