From edc10bcb956e790e5704029e732d0c75bbd9f250 Mon Sep 17 00:00:00 2001 From: pengtao Date: Wed, 17 Jul 2019 17:48:26 +0800 Subject: [PATCH] =?UTF-8?q?=20=E6=B7=BB=E5=8A=A0=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E6=9D=A1=E6=95=B0=E6=8E=A7=E5=88=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ad_interface_tornado.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/ad_interface_tornado.py b/ad_interface_tornado.py index 5c088c6..c8f99ad 100644 --- a/ad_interface_tornado.py +++ b/ad_interface_tornado.py @@ -68,7 +68,8 @@ def send_cache_data(): if line['ad_num'] > num: my_redis.sadd(key, line['id']) 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: my_redis.srem(key, line['id']) log.info(f"remove {line['id']} from {key}!") @@ -153,9 +154,9 @@ class DispatchHandler(tornado.web.RequestHandler): # 如果取得的记录条数大于预设,扔掉多余的记录,当前采用的是随机选择,以后可能需要添加加权选择 id_list = [] if limit < len(ids): - nums=limit + nums = limit else: - nums=len(ids) + nums = len(ids) for i in range(nums): while 1: