mirror of
https://github.com/restic/rest-server.git
synced 2025-12-07 09:36:13 -08:00
Sync BLOB's to disk before returning OK status
This slows down backup command up to 25% on a very fast network (read: localhost), but is the right thing to do. Safety first, performance second.
This commit is contained in:
@@ -190,6 +190,12 @@ func SaveBlob(c *Context) http.HandlerFunc {
|
||||
os.Remove(tmp)
|
||||
return
|
||||
}
|
||||
if err := tf.Sync(); err != nil {
|
||||
http.Error(w, "500 internal server error", 500)
|
||||
tf.Close()
|
||||
os.Remove(tmp)
|
||||
return
|
||||
}
|
||||
if err := tf.Close(); err != nil {
|
||||
http.Error(w, "500 internal server error", 500)
|
||||
os.Remove(tmp)
|
||||
|
||||
Reference in New Issue
Block a user