]> git.ipfire.org Git - thirdparty/kea.git/commitdiff
[1259] Use a constant for 100 updates
authorMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 3 Oct 2011 09:02:27 +0000 (11:02 +0200)
committerMichal 'vorner' Vaner <michal.vaner@nic.cz>
Mon, 3 Oct 2011 09:02:27 +0000 (11:02 +0200)
src/lib/python/isc/xfrin/diff.py

index 6c0540121b2fbbe1b0e96dcded5a2c0e525e442e..962e51c283d3e2c7d4227caba44af6468bed18cb 100644 (file)
@@ -26,6 +26,17 @@ class NoSuchZone(Exception):
     """
     pass
 
+"""
+This is the amount of changes we accumulate before calling Diff.apply
+automatically.
+
+The number 100 is just taken from Bind9. We don't know the rationale
+for exactly this amount, but we think it is just some randomly chosen
+number.
+"""
+# If changing this, modify the tests accordingly as well.
+DIFF_APPLY_TRESHOLD = 100
+
 class Diff:
     """
     The class represents a diff against current state of datasource on
@@ -81,7 +92,7 @@ class Diff:
             raise ValueError('The rrset must contain exactly 1 Rdata, but ' +
                              'it holds ' + str(rr.get_rdata_count()))
         self.__buffer.append((operation, rr))
-        if len(self.__buffer) >= 100:
+        if len(self.__buffer) >= DIFF_APPLY_TRESHOLD:
             # Time to auto-apply, so the data don't accumulate too much
             self.apply()