Commit d49d0e4b authored by 赵威's avatar 赵威

scan redis

parent 81986785
import datetime
from utils.cache import redis_client2
from utils.portrait import user_portrait_tag3_get_candidate_unread_list
def user_portrait_scan_info():
try:
round = 0
all_count = 0
# keys = "doris:user_portrait:tag3:device_id:*"
keys = "doris:user_portrait:tag3:candidate:diary:device_id:*"
cur, results = redis_client2.scan(0, keys, 3000)
while cur != 0:
round += 1
print("round: " + str(round))
cur, results = redis_client2.scan(cur, keys, 3000)
for key in results:
key = str(key, "utf-8")
device_id = key.split(":")[-1]
print(device_id)
print(user_portrait_tag3_get_candidate_unread_list(device_id, "diary")[:10])
all_count += 1
# user_portrait_get_empty_candidates(device_id)
print("all count: " + str(all_count))
print("scan done " + str(datetime.datetime.now()))
except Exception as e:
print(e)
if __name__ == "__main__":
device_id = "androidid_a25a1129c0b38f7b"
res = user_portrait_tag3_get_candidate_unread_list(device_id, "diary")
print(res)
# device_id = "androidid_a25a1129c0b38f7b"
# res = user_portrait_tag3_get_candidate_unread_list(device_id, "diary")
# print(res)
user_portrait_scan_info()
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