alfem/telegram-download-daemon

Limit the parallelism degree

Closed this issue · 5 comments

I think the amount of parallel downloads should be in the amount of CPU cores, or something similar.

Because there is a limit of how we can download in any moment, and if this moment shared with a lot of downloads, it will take a long time for the first download to finish.

So we need a queue, maybe python can handle this out of the box, and if not, we want to decide on the parallelism degree.

We can use asyncio.Semaphore to block when there are too many parallel downloads at once.

Just a question, why not using asyncio.Queue as this example?

Ah yes, asyncio.Queue is better for your usecase.

Thanks for your response. Do you want to implement this?

I don't familiar with the asyncio feature, and I think we not in ideal case here, since we use an existing Event Loop from telethon, am I right?

Sorry for being late, but yes, I'd like to implement this, and we are using the same event loop that telethon is using.