speed optimizations
This commit is contained in:
@@ -7,6 +7,8 @@ import (
|
||||
"os"
|
||||
)
|
||||
|
||||
const copyBufferSize = 4 * 1024 * 1024 // 4MB buffer for large file copies
|
||||
|
||||
func CopyFile(src, dst string) (err error) {
|
||||
slog.Info("copying file", "src", src, "dst", dst)
|
||||
|
||||
@@ -31,7 +33,9 @@ func CopyFile(src, dst string) (err error) {
|
||||
}
|
||||
}()
|
||||
|
||||
written, err := io.Copy(dstFile, srcFile)
|
||||
// Use a larger buffer for better performance with large database files
|
||||
buf := make([]byte, copyBufferSize)
|
||||
written, err := io.CopyBuffer(dstFile, srcFile, buf)
|
||||
if err != nil {
|
||||
return fmt.Errorf("copying data: %w", err)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user