diff --git a/lib/persistedmap/persistedmap.go b/lib/persistedmap/persistedmap.go index e2f83688..76f27064 100644 --- a/lib/persistedmap/persistedmap.go +++ b/lib/persistedmap/persistedmap.go @@ -64,13 +64,13 @@ func (p *PersistedMap) flushRoutine() { } func (p *PersistedMap) flush() error { - p.mu.Lock() - defer p.mu.Unlock() - if !p.shouldSave { return nil } + p.mu.Lock() + defer p.mu.Unlock() + file, err := os.Create(p.filePath) if err != nil { return fmt.Errorf("failed to create file: %w", err)