Commit ac81d393 authored by ale's avatar ale
Browse files

ignore None values in hmget() result

parent d39fcc70
...@@ -62,8 +62,10 @@ class Accounting(object): ...@@ -62,8 +62,10 @@ class Accounting(object):
while True: while True:
try: try:
old_values = [json.loads(x) for x in pipe.hmget(aggr_key, days)] old_aggr = {}
old_aggr = dict(zip(days, old_values)) for day, data in zip(days, pipe.hmget(aggr_key, days)):
if data:
old_aggr[day] = json.loads(data)
pipe.multi() pipe.multi()
for day, aggr_data in aggr.iteritems(): for day, aggr_data in aggr.iteritems():
old_aggr_data = old_aggr.get(day, {}) old_aggr_data = old_aggr.get(day, {})
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment