refactor(auth): simplify auth directory scanning and improve JSON processing logic

- Replaced `filepath.Walk` with `os.ReadDir` for cleaner directory traversal.
- Fixed `isAuthJSON` check to use `filepath.Dir` for directory comparison.
- Updated auth hash cache generation and file synthesis to improve readability and maintainability.
This commit is contained in:
Luis Pater
2026-04-12 13:32:03 +08:00
parent a583463d60
commit 6c0a1efd71
3 changed files with 40 additions and 32 deletions
+5 -5
View File
@@ -2903,19 +2903,19 @@ func (m *Manager) StartAutoRefresh(parent context.Context, interval time.Duratio
}
m.mu.Lock()
cancel := m.refreshCancel
cancelPrev := m.refreshCancel
m.refreshCancel = nil
m.refreshLoop = nil
m.mu.Unlock()
if cancel != nil {
cancel()
if cancelPrev != nil {
cancelPrev()
}
ctx, cancel := context.WithCancel(parent)
ctx, cancelCtx := context.WithCancel(parent)
loop := newAuthAutoRefreshLoop(m, interval)
m.mu.Lock()
m.refreshCancel = cancel
m.refreshCancel = cancelCtx
m.refreshLoop = loop
m.mu.Unlock()