Skip to content

Commit

Permalink
lib/db: Hold update lock while taking snapshot (#9496)
Browse files Browse the repository at this point in the history
  • Loading branch information
calmh committed Apr 5, 2024
1 parent faa56b4 commit 2e7c034
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/db/set.go
Expand Up @@ -168,6 +168,10 @@ type Snapshot struct {
func (s *FileSet) Snapshot() (*Snapshot, error) {
opStr := fmt.Sprintf("%s Snapshot()", s.folder)
l.Debugf(opStr)

s.updateMutex.Lock()
defer s.updateMutex.Unlock()

t, err := s.db.newReadOnlyTransaction()
if err != nil {
s.db.handleFailure(err)
Expand Down

0 comments on commit 2e7c034

Please sign in to comment.