diff options
| author | dumpfmprod <dumpfmprod@ubuntu.(none)> | 2010-10-24 20:16:20 -0400 |
|---|---|---|
| committer | dumpfmprod <dumpfmprod@ubuntu.(none)> | 2010-10-24 20:16:20 -0400 |
| commit | fafbde26383e42858538046d4b2b3691e21bd898 (patch) | |
| tree | b8f9d164305e92d1bbc8b7f5a278c195a3903a16 /scripts/hiscores.py | |
| parent | d79fb90ae279d0f46606c305688e97e73374eacc (diff) | |
Update python scripts
Diffstat (limited to 'scripts/hiscores.py')
| -rw-r--r-- | scripts/hiscores.py | 12 |
1 files changed, 6 insertions, 6 deletions
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) |
