diff options
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) |
