[tor-commits] [metrics-db/master] Don't overwrite past bridge network statuses unless we have to.

karsten at torproject.org karsten at torproject.org
Fri Jan 13 11:28:35 UTC 2012


commit b63021a84f9dc43efe62cfb14c704aeaeec150dc
Author: Karsten Loesing <karsten.loesing at gmx.net>
Date:   Fri Jan 13 12:27:11 2012 +0100

    Don't overwrite past bridge network statuses unless we have to.
    
    In theory, overwriting files with the same content doesn't hurt.  But it
    makes it harder to identify only the files changed in the past 3 days for
    the rsync/ directory.
---
 .../ernie/db/SanitizedBridgesWriter.java           |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)

diff --git a/src/org/torproject/ernie/db/SanitizedBridgesWriter.java b/src/org/torproject/ernie/db/SanitizedBridgesWriter.java
index 520fd1f..a3ead19 100644
--- a/src/org/torproject/ernie/db/SanitizedBridgesWriter.java
+++ b/src/org/torproject/ernie/db/SanitizedBridgesWriter.java
@@ -982,6 +982,13 @@ public class SanitizedBridgesWriter {
       return;
     }
 
+    /* Check if we need to overwrite the status file on disk. */
+    if (new String(data).equals(scrubbed)) {
+      this.logger.fine("The bridge network status published " + published
+          + " has not changed, so we're not attempting to rewrite it.");
+      return;
+    }
+
     try {
       /* Determine file name. */
       String syear = published.substring(0, 4);



More information about the tor-commits mailing list