From f69af9319b869ca68fc5f9c83429eb89432a4cd2 Mon Sep 17 00:00:00 2001 From: Robin Tang Date: Wed, 26 Jun 2024 11:00:50 -0700 Subject: [PATCH] Move --- lib/persistedmap/persistedmap.go | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) 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)