diff --git a/pantalaimon/client.py b/pantalaimon/client.py index 01b3295..4e0ea85 100644 --- a/pantalaimon/client.py +++ b/pantalaimon/client.py @@ -575,8 +575,8 @@ class PanClient(AsyncClient): ) self.task = task - if self.pan_conf.sync_stop_after > 0: - self.last_sync_task = loop.create_task(self.can_stop_sync()) + # if self.pan_conf.sync_stop_after > 0: + # self.last_sync_task = loop.create_task(self.can_stop_sync()) return task diff --git a/pantalaimon/config.py b/pantalaimon/config.py index 47ca53d..0d09d5c 100644 --- a/pantalaimon/config.py +++ b/pantalaimon/config.py @@ -39,8 +39,8 @@ class PanConfigParser(configparser.ConfigParser): "IndexingBatchSize": "100", "HistoryFetchDelay": "3000", "DebugEncryption": "False", - "SyncOnStartup": "True", - "StopSyncingTimeout": "0" + "SyncOnStartup": "False", + "StopSyncingTimeout": "600" }, converters={ "address": parse_address, @@ -143,8 +143,8 @@ class ServerConfig: index_encrypted_only = attr.ib(type=bool, default=True) indexing_batch_size = attr.ib(type=int, default=100) history_fetch_delay = attr.ib(type=int, default=3) - sync_on_startup = attr.ib(type=bool, default=True) - sync_stop_after = attr.ib(type=int, default=0) + sync_on_startup = attr.ib(type=bool, default=False) + sync_stop_after = attr.ib(type=int, default=600) @attr.s @@ -212,8 +212,8 @@ class PanConfig: indexing_batch_size = section.getint("IndexingBatchSize") - sync_on_startup = section.getboolean("SyncOnStartup") - sync_stop_after = section.getint("SyncStopAfter") + sync_on_startup = False #section.getboolean("SyncOnStartup") + sync_stop_after = 600 #section.getint("SyncStopAfter") if not 1 < indexing_batch_size <= 1000: raise PanConfigError( diff --git a/pantalaimon/daemon.py b/pantalaimon/daemon.py index 07384c2..b814614 100755 --- a/pantalaimon/daemon.py +++ b/pantalaimon/daemon.py @@ -924,8 +924,8 @@ class ProxyDaemon: # The room isn't encrypted just forward the message. if not encrypt: - content_msgtype = content["msgtype"] - if content_msgtype in ["m.image", "m.video", "m.audio", "m.file"] or msgtype == "m.room.avatar": + content_msgtype = content.get("msgtype") + if content_msgtype is not None and content_msgtype in ["m.image", "m.video", "m.audio", "m.file"] or msgtype == "m.room.avatar": try: content = await self._map_decrypted_uri("url", content, request, client) return await self.forward_to_web(request, data=json.dumps(content), token=client.access_token) @@ -940,7 +940,7 @@ class ProxyDaemon: async def _send(ignore_unverified=False): try: - content_msgtype = content["msgtype"] + content_msgtype = content.get("msgtype") if content_msgtype in ["m.image", "m.video", "m.audio", "m.file"] or msgtype == "m.room.avatar": upload_info, media_info = self._get_upload_and_media_info("url", content) if not upload_info or not media_info: