mirror of
https://github.com/restic/rest-server.git
synced 2025-10-19 23:53:20 +00: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:
parent
65c1af31fe
commit
bbca04fd7e
1 changed files with 6 additions and 0 deletions
|
@ -190,6 +190,12 @@ func SaveBlob(c *Context) http.HandlerFunc {
|
||||||
os.Remove(tmp)
|
os.Remove(tmp)
|
||||||
return
|
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 {
|
if err := tf.Close(); err != nil {
|
||||||
http.Error(w, "500 internal server error", 500)
|
http.Error(w, "500 internal server error", 500)
|
||||||
os.Remove(tmp)
|
os.Remove(tmp)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue