From 5adf916c51e11bb9fac6ad6654ffb558d394f979 Mon Sep 17 00:00:00 2001
From: Arnaud Fontaine <arnaud.fontaine@nexedi.com>
Date: Sat, 18 Jun 2011 12:54:28 +0000
Subject: [PATCH] Ensure the file is written to the disk when publishing the
 results

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk/utils@45917 20353a03-c40f-0410-a6d1-a30d3c3de9de
---
 erp5/util/benchmark/benchmark.py | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/erp5/util/benchmark/benchmark.py b/erp5/util/benchmark/benchmark.py
index dc5bf3803b..98498e4e3e 100644
--- a/erp5/util/benchmark/benchmark.py
+++ b/erp5/util/benchmark/benchmark.py
@@ -355,6 +355,8 @@ class BenchmarkProcess(multiprocessing.Process):
           self._current_repeat += 1
 
           if self._current_repeat == 5 and self._publish_method:
+            result_file.flush()
+            os.fsync(result_file.fileno())
             self._publish_method(self._result_filename, result_file.tell())
 
       except StopIteration, e:
@@ -368,6 +370,8 @@ class BenchmarkProcess(multiprocessing.Process):
 
       else:
         if self._publish_method:
+          result_file.flush()
+          os.fsync(result_file.fileno())
           self._publish_method(self._result_filename, result_file.tell())
 
     self._exit_msg_queue.put(exit_msg)
-- 
2.30.9