Merge pull request 'fix: use full Lock in State.Save() to prevent data race (closes #17)' (#20) from fix/state-save-data-race into main
Some checks failed
Check / check (push) Failing after 5m43s
Some checks failed
Check / check (push) Failing after 5m43s
Reviewed-on: #20
This commit is contained in:
commit
8cfff5dcc8
@ -156,8 +156,8 @@ func (s *State) Load() error {
|
|||||||
|
|
||||||
// Save writes the current state to disk atomically.
|
// Save writes the current state to disk atomically.
|
||||||
func (s *State) Save() error {
|
func (s *State) Save() error {
|
||||||
s.mu.RLock()
|
s.mu.Lock()
|
||||||
defer s.mu.RUnlock()
|
defer s.mu.Unlock()
|
||||||
|
|
||||||
s.snapshot.LastUpdated = time.Now().UTC()
|
s.snapshot.LastUpdated = time.Now().UTC()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user