Change conditions for delete

master
Thor 3 years ago
parent bfdfc901fe
commit f812744668
  1. 11
      fedidel.py

@ -105,10 +105,9 @@ class Instance:
while True:
try:
self.state_lock.acquire()
min_id = self.state["min_id"]
self.state_lock.release()
statuses = self.api.account_statuses(my_id, min_id = min_id)
statuses = self.api.account_statuses(my_id, min_id = self.state["min_id"])
while not statuses is None and len(statuses) > 0:
log_print(self.name, "Found {} new status(es)".format(len(statuses)))
@ -116,12 +115,13 @@ class Instance:
for status in sorted(statuses,
key = lambda status: status["created_at"]):
self.track_status(status)
self.state["min_id"] = status["id"]
self.save_state()
statuses = self.api.fetch_previous(statuses)
# Rate limit (300 requests per 5 minutes, i.e. 1 per second)
# Rate limit (max 300 requests per 5 minutes, i.e. 1 per second)
time.sleep(1)
except:
@ -206,15 +206,12 @@ class Instance:
timeslot_key = encode_time(status["created_at"])
self.state_lock.acquire()
if status["reblog"] is None:
if status["reblog"] is None and not status["visibility"] is "direct":
timeslots = self.state["timeslots"]
if not timeslot_key in timeslots:
timeslots[timeslot_key] = set()
timeslots[timeslot_key].add(status_id)
if status_id > self.state["min_id"]:
self.state["min_id"] = status_id
self.state_lock.release()
def next_expired(self):

Loading…
Cancel
Save