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

add

parent d3e160fa
...@@ -100,18 +100,13 @@ def topic_key(): ...@@ -100,18 +100,13 @@ def topic_key():
cursor = new_cursor cursor = new_cursor
def search(): 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 cursor = 0
while True: 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 = [] print(len(keys_list))
for i in keys_list: r.delete(*keys_list)
if r.ttl(i) == -1:
delete_keys.append(i)
if len(delete_keys) == 100:
print(delete_keys)
break
# 循环一遍后结束 # 循环一遍后结束
if new_cursor == 0: if new_cursor == 0:
......
...@@ -56,13 +56,14 @@ def es_query(doc, body, offset, size, es=None): ...@@ -56,13 +56,14 @@ def es_query(doc, body, offset, size, es=None):
from_=offset, from_=offset,
size=size) size=size)
# number = res["hits"]["total"] number = res["hits"]["total"]
total = res["hits"]["hits"] return number
print(total) # total = res["hits"]["hits"]
r = [] # print(total)
for i in total: # r = []
r.append(i['_source']['id']) # for i in total:
return r # r.append(i['_source']['id'])
# return r
def answer(): 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