mirror of
https://gitlab.com/chicken-riders/RcGcDw.git
synced 2025-02-23 00:24:09 +00:00
Added more safeguards to prevent sending again the same messages
This commit is contained in:
parent
406ac11e97
commit
51d8987756
|
@ -603,6 +603,7 @@ class recent_changes_class(object):
|
|||
groups = {}
|
||||
unsent_messages = []
|
||||
streak = -1
|
||||
last_datetime = datetime.datetime.fromisoformat("1999-01-01T00:00:00")
|
||||
if settings["limitrefetch"] != -1:
|
||||
with open("lastchange.txt", "r") as record:
|
||||
file_content = record.read().strip()
|
||||
|
@ -673,13 +674,17 @@ class recent_changes_class(object):
|
|||
self.streak = -1
|
||||
send(_("Connection to {wiki} seems to be stable now.").format(wiki=settings["wikiname"]), _("Connection status"), settings["avatars"]["connection_restored"])
|
||||
for change in changes:
|
||||
if change["rcid"] in self.ids:
|
||||
if change["rcid"] in self.ids or change["rcid"] < self.recent_id or datetime.datetime.fromisoformat(change["timestamp"][0:19]) < self.last_datetime:
|
||||
logging.debug("Change ({}) is in ids or is lower than recent_id {}".format(change["rcid"]), self.recent_id)
|
||||
continue
|
||||
logging.debug(self.ids)
|
||||
logging.debug(self.recent_id)
|
||||
self.add_cache(change)
|
||||
if clean and not (self.recent_id == 0 and change["rcid"] > self.file_id):
|
||||
logging.debug("Rejected {val}".format(val=change["rcid"]))
|
||||
continue
|
||||
first_pass(change)
|
||||
self.last_datetime = change["timestamp"]
|
||||
return change["rcid"]
|
||||
|
||||
def safe_request(self, url):
|
||||
|
|
Loading…
Reference in a new issue