Limit concurrent thumbnail downloads to 8
This commit is contained in:
parent
9decd58992
commit
329c34cf94
|
@ -20,6 +20,8 @@ from nio.api import ResizingMethod
|
|||
Size = Tuple[int, int]
|
||||
ImageData = Tuple[bytearray, Size, int] # last int: pyotherside format enum
|
||||
|
||||
CONCURRENT_DOWNLOADS_LIMIT = asyncio.BoundedSemaphore(8)
|
||||
|
||||
|
||||
@dataclass
|
||||
class Thumbnail:
|
||||
|
@ -85,6 +87,7 @@ class Thumbnail:
|
|||
)
|
||||
parsed = urlparse(self.mxc)
|
||||
|
||||
async with CONCURRENT_DOWNLOADS_LIMIT:
|
||||
response = await client.thumbnail(
|
||||
server_name = parsed.netloc,
|
||||
media_id = parsed.path.lstrip("/"),
|
||||
|
|
Loading…
Reference in New Issue
Block a user