lib/db: Hold update lock while taking snapshot (#9496)

This commit is contained in:
Jakob Borg 2024-04-05 21:32:43 +02:00 committed by GitHub
parent faa56b4bb7
commit 2e7c03420f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 0 deletions

View File

@ -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)