Эх сурвалжийг харах

Set up double puppeting before syncing own puppet info

This avoids delays with double puppeting if syncing takes long for some reason
Tulir Asokan 2 жил өмнө
parent
commit
82cd31ee2a

+ 4 - 4
mautrix_instagram/user.py

@@ -451,16 +451,16 @@ class User(DBUser, BaseUser):
 
     async def _try_sync_puppet(self, user_info: CurrentUser) -> None:
         puppet = await pu.Puppet.get_by_pk(self.igpk)
-        try:
-            await puppet.update_info(user_info, self)
-        except Exception:
-            self.log.exception("Failed to update own puppet info")
         try:
             if puppet.custom_mxid != self.mxid and puppet.can_auto_login(self.mxid):
                 self.log.info("Automatically enabling custom puppet")
                 await puppet.switch_mxid(access_token="auto", mxid=self.mxid)
         except Exception:
             self.log.exception("Failed to automatically enable custom puppet")
+        try:
+            await puppet.update_info(user_info, self)
+        except Exception:
+            self.log.exception("Failed to update own puppet info")
 
     async def _try_sync(self) -> None:
         try: