Commit 8ed29868 authored by 张彦钊's avatar 张彦钊

add

parent d3e160fa
......@@ -100,18 +100,13 @@ def topic_key():
cursor = new_cursor
def search():
r = redis.StrictRedis.from_url('redis://:ReDis!GmTx*0aN6@172.16.40.133:6379')
r = redis.StrictRedis.from_url('redis://:ReDis!GmTx*0aN9@172.16.40.173:6379')
cursor = 0
while True:
new_cursor,keys_list = r.scan(cursor,"*",10000)
new_cursor,keys_list = r.scan(cursor,"device:latest:action:tag:names:update:flag:*",1000)
delete_keys = []
for i in keys_list:
if r.ttl(i) == -1:
delete_keys.append(i)
if len(delete_keys) == 100:
print(delete_keys)
break
print(len(keys_list))
r.delete(*keys_list)
# 循环一遍后结束
if new_cursor == 0:
......
......@@ -56,13 +56,14 @@ def es_query(doc, body, offset, size, es=None):
from_=offset,
size=size)
# number = res["hits"]["total"]
total = res["hits"]["hits"]
print(total)
r = []
for i in total:
r.append(i['_source']['id'])
return r
number = res["hits"]["total"]
return number
# total = res["hits"]["hits"]
# print(total)
# r = []
# for i in total:
# r.append(i['_source']['id'])
# return r
def answer():
......
This source diff could not be displayed because it is too large. You can view the blob instead.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment