[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[or-cvs] r21937: {weather} Don't risk counter overflows for Tor relays that are down fo (weather/trunk/lib/weather)
Author: kaner
Date: 2010-03-13 20:23:20 +0000 (Sat, 13 Mar 2010)
New Revision: 21937
Modified:
weather/trunk/lib/weather/queries.py
Log:
Don't risk counter overflows for Tor relays that are down for too long
Modified: weather/trunk/lib/weather/queries.py
===================================================================
--- weather/trunk/lib/weather/queries.py 2010-03-13 20:13:07 UTC (rev 21936)
+++ weather/trunk/lib/weather/queries.py 2010-03-13 20:23:20 UTC (rev 21937)
@@ -13,6 +13,6 @@
CREATE TABLE IF NOT EXISTS '%s' (id INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT, email VARCHAR(255) NOT NULL, node VARCHAR(255) NOT NULL, subs_auth VARCHAR(255) NOT NULL, unsubs_auth VARCHAR(255) NOT NULL, subscribed INTEGER NOT NULL, downtime_grace INTEGER NOT NULL, seen_down INTEGER NOT NULL, noticed INTEGER NOT NULL)
"""
ALL_BY_ID_Q = "SELECT * from subscriptions WHERE id = '%s'"
-UPDATE_DOWN_Q = "UPDATE subscriptions SET seen_down = seen_down + 1 WHERE id = '%s'"
+UPDATE_DOWN_Q = "UPDATE subscriptions SET seen_down = seen_down + 1 WHERE id = '%s' AND seen_down < 8760"
UPDATE_NOTICED_Q = "UPDATE subscriptions SET noticed = 1 WHERE id = '%s'"
RESET_COUNT_Q = "UPDATE subscriptions SET seen_down = 0, noticed = 0 WHERE (id = '%s') AND (seen_down > 0) AND (noticed > 0)"