mirror of
https://github.com/restic/rest-server.git
synced 2025-10-19 07:33:21 +00:00
Fix inverted condition for fsync warning
The warning should only be printed if fsync is _not_ supported and not the other way around.
This commit is contained in:
parent
30ec84fcb7
commit
b2e8044fbd
1 changed files with 5 additions and 4 deletions
|
@ -638,15 +638,16 @@ func (h *Handler) saveBlob(w http.ResponseWriter, r *http.Request) {
|
|||
return
|
||||
}
|
||||
|
||||
if !syncNotSup {
|
||||
if syncNotSup {
|
||||
h.fsyncWarning.Do(func() {
|
||||
log.Print("WARNING: fsync is not supported by the data storage. This can lead to data loss, if the system crashes or the storage is unexpectedly disconnected.")
|
||||
})
|
||||
} else {
|
||||
if err := syncDir(filepath.Dir(path)); err != nil {
|
||||
// Don't call os.Remove(path) as this is prone to race conditions with parallel upload retries
|
||||
h.internalServerError(w, err)
|
||||
return
|
||||
}
|
||||
h.fsyncWarning.Do(func() {
|
||||
log.Print("WARNING: fsync is not supported by the data storage. This can lead to data loss, if the system crashes or the storage is unexpectedly disconnected.")
|
||||
})
|
||||
}
|
||||
|
||||
h.sendMetric(objectType, BlobWrite, uint64(written))
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue