Post IRC message on cleanup

This commit is contained in:
Mark Veidemanis 2022-05-11 22:08:04 +01:00
parent 74e108603f
commit c8e9368247
Signed by: m
GPG Key ID: 5ACFCEED46C0904F
2 changed files with 8 additions and 2 deletions

View File

@ -125,9 +125,13 @@ def cleanup(subclass, references):
:param references: list of references to reconcile against :param references: list of references to reconcile against
:type references: list :type references: list
""" """
messages = []
for tx, reference in get_ref_map().items(): for tx, reference in get_ref_map().items():
if reference not in references: if reference not in references:
if get_subclass(reference) == subclass: if get_subclass(reference) == subclass:
log.info(f"Archiving trade reference: {reference} / TX: {tx}") logmessage = f"Archiving trade reference: {reference} / TX: {tx}"
messages.append(logmessage)
log.info(logmessage)
r.rename(f"trade.{tx}.reference", f"archive.trade.{tx}.reference") r.rename(f"trade.{tx}.reference", f"archive.trade.{tx}.reference")
r.rename(f"trade.{reference}", f"archive.trade.{reference}") r.rename(f"trade.{reference}", f"archive.trade.{reference}")
return messages

View File

@ -171,7 +171,9 @@ class Local(util.Base):
self.last_dash.remove(ref) self.last_dash.remove(ref)
if reference and reference not in current_trades: if reference and reference not in current_trades:
current_trades.append(reference) current_trades.append(reference)
db.cleanup(self.platform, current_trades) messages = db.cleanup(self.platform, current_trades)
for message in messages:
self.ux.irc.sendmsg(f"{self.platform}: {message}")
def got_recent_messages(self, messages, send_irc=True): def got_recent_messages(self, messages, send_irc=True):
""" """