From 114e54701307f5fe34ae29eec732f1a5c06408d3 Mon Sep 17 00:00:00 2001 From: pengtao Date: Wed, 17 Jul 2019 15:19:04 +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 | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ad_interface_tornado.py b/ad_interface_tornado.py index 149f2e9..8709da9 100644 --- a/ad_interface_tornado.py +++ b/ad_interface_tornado.py @@ -137,7 +137,11 @@ class DispatchHandler(tornado.web.RequestHandler): id_list = [] if limit < len(ids): for i in range(limit): - id_list.append(my_redis.srandmember(key)) + while 1: + new = my_redis.srandmember(key) + if new not in id_list: + id_list.append(new) + break for id in id_list: temp = my_redis.hgetall(f"ad::{id}::info") info.append(temp)