Mercurial > public > sg101
comparison gpp/forums/latest.py @ 524:d9cf6f60b5a5
Fix for trying to redis.mget() and empty list of keys.
author | Brian Neal <bgneal@gmail.com> |
---|---|
date | Mon, 19 Dec 2011 00:05:03 +0000 |
parents | e9c446a64423 |
children | 7388cdf61b25 |
comparison
equal
deleted
inserted
replaced
523:e9c446a64423 | 524:d9cf6f60b5a5 |
---|---|
300 try: | 300 try: |
301 conn = get_redis_connection() | 301 conn = get_redis_connection() |
302 result = conn.zrevrange(UPDATED_TOPICS_SET_KEY, 0, num - 1) | 302 result = conn.zrevrange(UPDATED_TOPICS_SET_KEY, 0, num - 1) |
303 | 303 |
304 topic_keys = [UPDATED_TOPIC_KEY % n for n in result] | 304 topic_keys = [UPDATED_TOPIC_KEY % n for n in result] |
305 json_list = conn.mget(topic_keys) | 305 json_list = conn.mget(topic_keys) if topic_keys else [] |
306 | 306 |
307 except redis.RedisError, e: | 307 except redis.RedisError, e: |
308 logger.error(e) | 308 logger.error(e) |
309 return [] | 309 return [] |
310 | 310 |