添加返回条数控制

This commit is contained in:
pengtao 2019-07-17 17:26:48 +08:00
parent 9f46534a3e
commit f62e4c2489

View File

@ -154,7 +154,11 @@ class DispatchHandler(tornado.web.RequestHandler):
# 如果取得的记录条数大于预设,扔掉多余的记录,当前采用的是随机选择,以后可能需要添加加权选择 # 如果取得的记录条数大于预设,扔掉多余的记录,当前采用的是随机选择,以后可能需要添加加权选择
id_list = [] id_list = []
if limit < len(ids): if limit < len(ids):
for i in range(limit): nums=limit
else:
nums=len(ids)
for i in range(nums):
while 1: while 1:
new = my_redis.srandmember(key) new = my_redis.srandmember(key)
if new not in id_list: if new not in id_list: