Add logging to find potential peer type mistakes

This commit is contained in:
Tulir Asokan
2019-10-28 01:10:36 +02:00
parent 5411de90fc
commit abd1adaabf
2 changed files with 4 additions and 1 deletions
-1
View File
@@ -434,7 +434,6 @@ class AbstractUser(ABC):
if isinstance(original_update, (UpdateEditMessage, UpdateEditChannelMessage)):
return await portal.handle_telegram_edit(self, sender, update)
self.log.debug("Handling message %s to %s by %s", update, portal.tgid_log, user)
return await portal.handle_telegram_message(self, sender, update)
# endregion
+4
View File
@@ -379,6 +379,10 @@ class BasePortal(ABC):
return cls.from_db(db_portal)
if peer_type:
cls.log.info(f"Creating portal for {peer_type} {tgid} (receiver {tg_receiver})")
if peer_type == "chat":
import traceback
cls.log.info("Chat portal stack trace:\n" + "".join(traceback.format_stack()))
portal = cls(tgid, peer_type=peer_type, tg_receiver=tg_receiver)
portal.db_instance.insert()
return portal