Flush changeset data to disk before making it live
authorTom Hughes <tom@compton.nu>
Wed, 7 Sep 2016 09:40:20 +0000 (10:40 +0100)
committerTom Hughes <tom@compton.nu>
Wed, 7 Sep 2016 10:02:27 +0000 (11:02 +0100)
.rubocop_todo.yml
cookbooks/planet/files/default/replication-bin/replicate-changesets

index 6bc5812c04c9b3aafa49ff6ac99631e9f64e86d8..343c145d3cc488741c4e0dbed47f5a11f6b4de9d 100644 (file)
@@ -27,7 +27,7 @@ Metrics/LineLength:
 # Offense count: 23
 # Configuration parameters: CountComments.
 Metrics/MethodLength:
-  Max: 28
+  Max: 30
 
 # Offense count: 1
 Metrics/PerceivedComplexity:
index fb3d6138af0dc0686c8b19b0c2f30847ffefe4a5..45e1a4a1cf3a8139141290d519ff7697b90e8e12 100644 (file)
@@ -196,10 +196,12 @@ class Replicator
         FileUtils.mkdir_p(File.dirname(data_file))
         Zlib::GzipWriter.open(tmp_data) do |fh|
           fh.write(changeset_dump(open_changesets))
+          fh.fdatasync
         end
         @state["sequence"] = sequence
         File.open(tmp_state, "w") do |fh|
           fh.write(YAML.dump(@state))
+          fh.fdatasync
         end
 
         # sanity check: the files we're moving into place