diff --git a/pyrogram/__init__.py b/pyrogram/__init__.py
index f23bb17c6..3f4493715 100644
--- a/pyrogram/__init__.py
+++ b/pyrogram/__init__.py
@@ -17,7 +17,7 @@
# along with Pyrogram. If not, see .
__fork_name__ = "pyrotgfork"
-__version__ = "2.1.33.9"
+__version__ = "2.1.33.10"
__license__ = "GNU Lesser General Public License v3.0 (LGPL-3.0)"
__copyright__ = "Copyright (C) 2017-present Dan "
diff --git a/pyrogram/client.py b/pyrogram/client.py
index 59a671349..2160aeb89 100644
--- a/pyrogram/client.py
+++ b/pyrogram/client.py
@@ -338,15 +338,9 @@ def __init__(
else:
self.storage = FileStorage(self.name, self.WORKDIR)
- self.connection_factory = Connection
- self.protocol_factory = TCPFull
-
self.dispatcher = Dispatcher(self)
-
self.rnd_id = MsgId
-
self.parser = Parser(self)
-
self.session = None
self.media_sessions = {}
diff --git a/pyrogram/session/session.py b/pyrogram/session/session.py
index 120fca439..443dd15a9 100644
--- a/pyrogram/session/session.py
+++ b/pyrogram/session/session.py
@@ -255,7 +255,6 @@ async def handle_packet(self, packet):
"Most likely the client time has to be synchronized.")
except SecurityCheckMismatch as e:
log.info("Discarding packet: %s", e)
- await self.connection.close()
return
else:
bisect.insort(self.stored_msg_ids, msg.msg_id)
@@ -423,7 +422,17 @@ async def invoke(
await asyncio.sleep(amount)
except (OSError, TimeoutError, InternalServerError, ServiceUnavailable) as e:
- if retries == 0:
+ if (
+ retries == 0 or
+ (
+ isinstance(e, InternalServerError) and
+ e.code == 500 and
+ (e.ID or e.NAME) in [
+ "HISTORY_GET_FAILED",
+ "PERSISTENT_TIMESTAMP_OUTDATED",
+ ]
+ )
+ ):
raise e from None
(log.warning if retries < 2 else log.info)(