fix some error

This commit is contained in:
pengtao 2019-07-15 19:20:32 +08:00
parent afa26ebb93
commit cf19e485ea

View File

@ -60,7 +60,7 @@ def send_cache_data():
for line in all:
key = f"{line.get('gameid', 0)}::{line.get('locationid', 0)}"
if my_redis.exists(key):
my_redis.sadd(key,line['id'])
my_redis.sadd(key, line['id'])
# 检查num是否已达到设定数值
num = my_redis.get(f"{line['id']::num")
if not num:
@ -70,13 +70,15 @@ def send_cache_data():
my_redis.srem(key, line['id'])
# 清理广告详细记录
my_redis.expire(f"{line['id']}::info", 0)
else:
my_redis.sadd(key, line['id'])
log.info(f"check {line['id']}::info")
else:
my_redis.sadd(key, line['id'])
log.info(f"check {line['id']}::info")
if not my_redis.exists(f"{line['id']}::info"):
my_redis.hmset(f"{line['id']}::info", line)
len_all = len(all)
log.info(f"write {len_all} to cache!")
my_redis.hmset(f"{line['id']}::info", line)
len_all = len(all)
log.info(f"write {len_all} to cache!")
class DispatchHandler(tornado.web.RequestHandler):