添加返回条数控制
This commit is contained in:
parent
514c8b58b1
commit
edc10bcb95
@ -68,7 +68,8 @@ def send_cache_data():
|
|||||||
if line['ad_num'] > num:
|
if line['ad_num'] > num:
|
||||||
my_redis.sadd(key, line['id'])
|
my_redis.sadd(key, line['id'])
|
||||||
my_redis.expire(key, 120)
|
my_redis.expire(key, 120)
|
||||||
log.info(f"add {line['id']} to {key} ,num was {line['ad_num']}!")
|
n = int(line['ad_num'] - num)
|
||||||
|
log.info(f"add {line['id']} to {key} ,num was {line['ad_num']},limit was {n}!")
|
||||||
else:
|
else:
|
||||||
my_redis.srem(key, line['id'])
|
my_redis.srem(key, line['id'])
|
||||||
log.info(f"remove {line['id']} from {key}!")
|
log.info(f"remove {line['id']} from {key}!")
|
||||||
@ -153,9 +154,9 @@ class DispatchHandler(tornado.web.RequestHandler):
|
|||||||
# 如果取得的记录条数大于预设,扔掉多余的记录,当前采用的是随机选择,以后可能需要添加加权选择
|
# 如果取得的记录条数大于预设,扔掉多余的记录,当前采用的是随机选择,以后可能需要添加加权选择
|
||||||
id_list = []
|
id_list = []
|
||||||
if limit < len(ids):
|
if limit < len(ids):
|
||||||
nums=limit
|
nums = limit
|
||||||
else:
|
else:
|
||||||
nums=len(ids)
|
nums = len(ids)
|
||||||
|
|
||||||
for i in range(nums):
|
for i in range(nums):
|
||||||
while 1:
|
while 1:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user