Skip to content
Snippets Groups Projects
Commit 45200d8a authored by Tulir Asokan's avatar Tulir Asokan :cat2:
Browse files

Log unknown MQTT events

parent f48b3664
Branches
Tags
No related merge requests found
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
# You should have received a copy of the GNU Affero General Public License # You should have received a copy of the GNU Affero General Public License
# along with this program. If not, see <https://www.gnu.org/licenses/>. # along with this program. If not, see <https://www.gnu.org/licenses/>.
from typing import (Any, Dict, List, Iterator, Optional, Iterable, Type, Callable, Awaitable, from typing import (Any, Dict, List, Iterator, Optional, Iterable, Type, Callable, Awaitable,
Union, TYPE_CHECKING) Union, TYPE_CHECKING, cast)
import asyncio import asyncio
import time import time
...@@ -123,6 +123,7 @@ class User(BaseUser): ...@@ -123,6 +123,7 @@ class User(BaseUser):
fbchat.Connect: self.on_connect, fbchat.Connect: self.on_connect,
fbchat.Disconnect: self.on_disconnect, fbchat.Disconnect: self.on_disconnect,
fbchat.Resync: self.on_resync, fbchat.Resync: self.on_resync,
fbchat.UnknownEvent: self.on_unknown_event,
} }
@property @property
...@@ -324,9 +325,8 @@ class User(BaseUser): ...@@ -324,9 +325,8 @@ class User(BaseUser):
self.log.warning("Error fetching own info, retrying...", exc_info=True) self.log.warning("Error fetching own info, retrying...", exc_info=True)
own_info = await self.client.fetch_thread_info([self.fbid]).__anext__() own_info = await self.client.fetch_thread_info([self.fbid]).__anext__()
puppet = pu.Puppet.get_by_fbid(self.fbid, create=True) puppet = pu.Puppet.get_by_fbid(self.fbid, create=True)
await puppet.update_info(source=self, info=own_info) await puppet.update_info(source=self, info=cast(fbchat.UserData, own_info))
await self.sync_contacts() await asyncio.gather(self.sync_contacts(), self.sync_threads())
await self.sync_threads()
async def _create_community(self) -> None: async def _create_community(self) -> None:
template = config["bridge.community_template"] template = config["bridge.community_template"]
...@@ -544,6 +544,9 @@ class User(BaseUser): ...@@ -544,6 +544,9 @@ class User(BaseUser):
except Exception: except Exception:
self.log.exception(f"Failed to handle {type(event)} event from Facebook") self.log.exception(f"Failed to handle {type(event)} event from Facebook")
async def on_unknown_event(self, evt: fbchat.UnknownEvent) -> None:
self.log.debug(f"Unknown event %s: %s", evt.source, evt.data)
async def on_connect(self, evt: fbchat.Connect) -> None: async def on_connect(self, evt: fbchat.Connect) -> None:
now = time.monotonic() now = time.monotonic()
disconnected_at = self._connection_time disconnected_at = self._connection_time
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment