Răsfoiți Sursa

lib/osutil: Remove unnecessary fsync in Copy()

Fsyncing the file has a small performance penalty and seems unnecessary. The
file will be fsynced anyway, when the changes are commited to the database.

GitHub-Pull-Request: https://github.com/syncthing/syncthing/pull/3749
Unrud 9 ani în urmă
părinte
comite
f1e83a57cd
1 a modificat fișierele cu 1 adăugiri și 4 ștergeri
  1. 1 4
      lib/osutil/osutil.go

+ 1 - 4
lib/osutil/osutil.go

@@ -172,10 +172,7 @@ func copyFileContents(src, dst string) (err error) {
 			err = cerr
 		}
 	}()
-	if _, err = io.Copy(out, in); err != nil {
-		return
-	}
-	err = out.Sync()
+	_, err = io.Copy(out, in)
 	return
 }