From: Brian Warner Date: Wed, 1 Oct 2008 00:30:53 +0000 (-0700) Subject: misc/cpu-watcher.tac: use writeaside-and-rename for the history.pickle file X-Git-Url: https://git.rkrishnan.org/vdrive/%5B%5E?a=commitdiff_plain;h=06770f720e45a5b4d4a9049a8f73630e5c511e98;p=tahoe-lafs%2Ftahoe-lafs.git misc/cpu-watcher.tac: use writeaside-and-rename for the history.pickle file --- diff --git a/misc/cpu-watcher.tac b/misc/cpu-watcher.tac index da8d29ab..9695a694 100644 --- a/misc/cpu-watcher.tac +++ b/misc/cpu-watcher.tac @@ -199,7 +199,8 @@ class CPUWatcher(service.MultiService, resource.Resource, Referenceable): except: log.msg("error reading process %s (%s), ignoring" % (pid, name)) log.err() - pickle.dump(self.history, open("history.pickle", "wb")) + pickle.dump(self.history, open("history.pickle.tmp", "wb")) + os.rename("history.pickle.tmp", "history.pickle") for (pid, name) in processes: row = [name] for avg in self.AVERAGES: