Skip to content

Commit

Permalink
Fix session not getting saved to media_sessions in save_file method. (T…
Browse files Browse the repository at this point in the history
  • Loading branch information
ALiwoto authored and SpEcHiDe committed Jan 30, 2024
1 parent 1aa4db7 commit e678c05
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions pyrogram/methods/advanced/save_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,10 +139,16 @@ async def worker(session):
is_missing_part = file_id is not None
file_id = file_id or self.rnd_id()
md5_sum = md5() if not is_big and not is_missing_part else None
session = Session(
self, await self.storage.dc_id(), await self.storage.auth_key(),
await self.storage.test_mode(), is_media=True
)
dc_id = await self.storage.dc_id()

session = self.media_sessions.get(dc_id)
if not session:
session = self.media_sessions[dc_id] = Session(
self, dc_id, await self.storage.auth_key(),
await self.storage.test_mode(), is_media=True
)
await session.start()

workers = [self.loop.create_task(worker(session)) for _ in range(workers_count)]
queue = asyncio.Queue(1)

Expand Down

0 comments on commit e678c05

Please sign in to comment.