fix: use full Lock in State.Save() to prevent data race (closes #17) #20

Merged
sneak merged 1 commits from fix/state-save-data-race into main 2026-02-21 11:22:47 +01:00
Showing only changes of commit b162ca743b - Show all commits

View File

@ -156,8 +156,8 @@ func (s *State) Load() error {
// Save writes the current state to disk atomically.
func (s *State) Save() error {
s.mu.RLock()
defer s.mu.RUnlock()
s.mu.Lock()
defer s.mu.Unlock()
s.snapshot.LastUpdated = time.Now().UTC()