添加返回条数控制
This commit is contained in:
parent
9f46534a3e
commit
f62e4c2489
@ -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:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user