Peter Palfrader pushed to branch master at snapshot / snapshot


Commits:
fec4bfc7 by Peter Palfrader at 2025-04-12T15:02:29+02:00
Try to sync data to disk when we import files into the farm

- - - - -


1 changed file:

- snapshot


Changes:

=====================================
snapshot
=====================================
@@ -92,7 +92,14 @@ class FileBackend < StorageBackend
                        fn = File.basename(target)
 
                        tmptarget = 
dir+"/.tmp."+randstring()+"."+(Process.pid.to_s)+"."+fn
-                       FileUtils.cp(source, tmptarget)
+                       # copy with fdatasync
+                       File.open(source) do |s|
+                               File.open(tmptarget, 'wb') do |f|
+                                       IO.copy_stream(s, f)
+                                       f.fdatasync()
+                               end
+                       end
+
                        begin
                                File.link(tmptarget, target)
                                add_to_journal(digest)



View it on GitLab: 
https://salsa.debian.org/snapshot-team/snapshot/-/commit/fec4bfc7a1d1ecbef411dca8677b6eb6f179d08b

-- 
View it on GitLab: 
https://salsa.debian.org/snapshot-team/snapshot/-/commit/fec4bfc7a1d1ecbef411dca8677b6eb6f179d08b
You're receiving this email because of your account on salsa.debian.org.


Reply via email to