From fafbde26383e42858538046d4b2b3691e21bd898 Mon Sep 17 00:00:00 2001 From: dumpfmprod Date: Sun, 24 Oct 2010 20:16:20 -0400 Subject: Update python scripts --- scripts/hiscores.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'scripts/hiscores.py') diff --git a/scripts/hiscores.py b/scripts/hiscores.py index e8a5ed0..b81269e 100644 --- a/scripts/hiscores.py +++ b/scripts/hiscores.py @@ -11,13 +11,12 @@ db.execute("SET CLIENT_ENCODING to 'UNICODE'") r = redis.Redis("localhost") key_prefix = "hiscore:" -hiscore_len = 40 config = { - "day": {"days": 1, "amt": hiscore_len}, - "week": {"days": 7, "amt": hiscore_len}, - "month": {"days": 30, "amt": hiscore_len}, - "all": {"days": 0, "amt": hiscore_len} + "day": {"days": 1, "amt": 40}, + "week": {"days": 7, "amt": 40}, + "month": {"days": 30, "amt": 40}, + "all": {"days": 0, "amt": 40} } def fetch_favs(days): @@ -70,9 +69,10 @@ if __name__ == "__main__": print('this script adds message ids to redis for the highest scoring posts over a period.') sys.exit(1) + # write to key and then overwrite keyfinal when complete keyfinal = key_prefix + period key = keyfinal + ":temp" - # write to key and then overwrite keyfinal when complete + r.delete(key) # in case temp key still exists bc script was killed chunks = fetch_favs(days) add_favs_to_redis(key, chunks) -- cgit v1.2.3-70-g09d2