Unverified Commit 11b83c61 authored by Isis Lovecruft's avatar Isis Lovecruft
Browse files

Add COLLECT_TIMESTAMPS option for configuring addOrUpdateBridgeHistory().

 * ADD a new option, `COLLECT_TIMESTAMPS` to the config file to configure
   whether or not to run the timestamp collection code, including
   `Stability.addOrUpdateBridgeHistory()`, in `Main.load()`.
 * FIXES #10724
parent 336eb625
......@@ -20,6 +20,11 @@
#
# CHANGELOG:
# ~~~~~~~~~~
# Changes in version 0.0.4 - 2014-01-24
# * ADD COLLECT_TIMESTAMPS option (see #10724). Set it to False for the
# staging instance (etc/test-bridgedb.conf), and True for the production
# server (etc/bridgedb.conf).
#
# Changes in version 0.0.3 - 2014-01-17
# * UPDATE config from bridgedb.git/bridgedb.conf, without changing any of the
# settings.
......@@ -146,6 +151,19 @@ FORCE_PORTS = [(443, 1)]
# Only "Stable" is now supported. This is a list of (flag,minimum) tuples.
FORCE_FLAGS = [("Stable", 1)]
#---------------------------
# Database/Parsing Options \
#------------------------------------------------------------------------------
#
# These options change various database transaction and descriptor parsing
# behaviours.
#------------------------------------------------------------------------------
# (boolean) If True, then collect, sort, and store all timestamps seen for all
# bridges. This operation is extremely expensive, and should be disabled when
# it is not necessary.
COLLECT_TIMESTAMPS = True
#-------------------------------
# HTTP(S) Distribution Options \
#------------------------------------------------------------------------------
......
......@@ -140,16 +140,17 @@ def load(state, splitter, clear=False):
# ns, then we skip it there, too.
splitter.insert(bridge)
if bridge.getID() in timestamps.keys():
ts = timestamps[bridge.getID()][:]
ts.sort()
for timestamp in ts:
logging.debug(
"Adding/updating timestamps in BridgeHistory for "\
"'%s' in database: %s"
% (bridge.fingerprint, timestamp))
bridgedb.Stability.addOrUpdateBridgeHistory(
bridge, timestamp)
if state.COLLECT_TIMESTAMPS:
if bridge.getID() in timestamps.keys():
ts = timestamps[bridge.getID()][:]
ts.sort()
for timestamp in ts:
logging.debug(
"Updating BridgeHistory timestamps for %s: %s"
% (bridge.fingerprint, timestamp))
bridgedb.Stability.addOrUpdateBridgeHistory(
bridge, timestamp)
logging.debug("Closing bridge-server-descriptor file: '%s'" % fname)
f.close()
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment