Commit cfc1ffa6 authored by litaolemo's avatar litaolemo

update

parent e42f876c
...@@ -96,7 +96,7 @@ class push_rule(object): ...@@ -96,7 +96,7 @@ class push_rule(object):
else: else:
repost_diff = -100 repost_diff = -100
print(datetime.datetime.now().timestamp(),fetch_time_last,fetch_time,comment_diff,favoratie_diff,repost_diff) # print(datetime.datetime.now().timestamp(),fetch_time_last,fetch_time,comment_diff,favoratie_diff,repost_diff)
if parse_mode == "and": if parse_mode == "and":
if comment_diff / time_diff >= self.comment_per_min and favoratie_diff / time_diff >= self.favorite_per_min and repost_diff / time_diff >= self.repost_per_min: if comment_diff / time_diff >= self.comment_per_min and favoratie_diff / time_diff >= self.favorite_per_min and repost_diff / time_diff >= self.repost_per_min:
return True return True
...@@ -117,20 +117,20 @@ def scan_from_redis(push_rule_class_list) -> Dict: ...@@ -117,20 +117,20 @@ def scan_from_redis(push_rule_class_list) -> Dict:
set_name = "exists_doc_id_set_%s" % datetime.datetime.now().strftime("%Y-%m-%d") set_name = "exists_doc_id_set_%s" % datetime.datetime.now().strftime("%Y-%m-%d")
rds.sadd(set_name, "test") rds.sadd(set_name, "test")
rds.expire(set_name, 259200) rds.expire(set_name, 259200)
out_ts = datetime.datetime.now().timestamp() * 1e3 - 86400000
doc_id = rds.lpop("doc_id") doc_id = rds.lpop("doc_id")
if doc_id: if doc_id:
res = rds.llen(doc_id) count_res = rds.llen(doc_id)
if res < 2: if count_res < 2:
continue continue
res_list = rds.lrange(doc_id, 0, 1) res_list = rds.lrange(doc_id, 0, 1)
fetch_time = 0 fetch_time = 0
repost_count = 0 repost_count = 0
comment_count = 0 comment_count = 0
favorite_count = 0 favorite_count = 0
for count, re in enumerate(res_list): for count, res in enumerate(res_list):
print(res)
out_ts = datetime.datetime.now().timestamp() * 1e3 - 86400000 out_ts = datetime.datetime.now().timestamp() * 1e3 - 86400000
one_data = json.loads(re) one_data = json.loads(res)
if count == 0: if count == 0:
fetch_time = one_data.get("fetch_time") fetch_time = one_data.get("fetch_time")
repost_count = one_data.get("repost_count") repost_count = one_data.get("repost_count")
......
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