perf(*): bound list queries, batch fetches, harden media downloads
This commit is contained in:
@@ -50,7 +50,7 @@ async def _reset_media_sessions(client: Client) -> None:
|
||||
async def download_bytes(client: Client, target: Downloadable) -> bytes | None:
|
||||
try:
|
||||
buffer = await client.download_media(target, in_memory=True)
|
||||
except TimeoutError:
|
||||
except (TimeoutError, OSError):
|
||||
await _reset_media_sessions(client)
|
||||
buffer = await client.download_media(target, in_memory=True)
|
||||
return buffer.getvalue() if isinstance(buffer, BytesIO) else None
|
||||
|
||||
Reference in New Issue
Block a user