diff options
| author | Scott Ostler <scottbot9000@gmail.com> | 2010-10-24 22:07:37 -0400 |
|---|---|---|
| committer | Scott Ostler <scottbot9000@gmail.com> | 2010-10-24 22:07:37 -0400 |
| commit | f4bdb335fb3bdae6cd82315917ebacfb939b665a (patch) | |
| tree | 2c3a960e4d7b380b3f38fc6b3e8b1ffaff228cd1 /scripts/hiscores.py | |
| parent | 33955c93ae8050778c75c18756585a59103ea86f (diff) | |
| parent | 8faf08aca6e0a251f13e7217487e6b18c463e02e (diff) | |
Merge branch 'master' of ssh://dump.fm/pichat/repo
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) |
