lib/persistentqueue/persistentqueue.go: remove fs.MustSyncPath() call after fs.MustWriteSync()

The fs.MustWriteSync() already fsyncs the created file, so there is no need in additional fsync() call.

While at it, add missing fsync for the parent directory after creating a directory for persistent queue.
This commit is contained in:
Aliaksandr Valialkin
2025-08-30 01:46:13 +02:00
parent 3b656147ef
commit 1aa72ecbfd

View File

@@ -178,6 +178,7 @@ func tryOpeningQueue(path, name string, chunkFileSize, maxBlockSize, maxPendingB
fs.MustClose(q.flockF)
}
}()
fs.MustSyncPathAndParentDir(path)
// Read metainfo.
var mi metainfo
@@ -643,7 +644,6 @@ func (mi *metainfo) WriteToFile(path string) error {
return fmt.Errorf("cannot marshal persistent queue metainfo %#v: %w", mi, err)
}
fs.MustWriteSync(path, data)
fs.MustSyncPath(path)
return nil
}