iSponsorBlockTV
iSponsorBlockTV copied to clipboard
Reduce dns requests with cache
Is your feature request related to a problem? Please describe.
The script is requesting the ip of www.youtube.com every 10 seconds, which is quite a lot.
Describe the solution you'd like It would be great some kind of dns caching to stop this "bombing".
it's interesting that in the main function the ttl is set to 300 in the tcp_connector variable.
But in reality is using the default ttl of aiohttp according to their docs
It’s like that since pyytlounge doesn’t use an already defined web session and creates a new one for each request. That library could be easily modified to use a web session and fix this problem. @FabioGNR would I be able to make such pr to you lib, maintaining the default functionality of not giving an already defined session?
Yeah, it should just use one session:
Unless you are connecting to a large, unknown number of different servers over the lifetime of your application, it is suggested you use a single session for the lifetime of your application to benefit from connection pooling.
If you need that to be a configurable session that's of course no problem. Feel free to submit a PR!
If you need that to be a configurable session that's of course no problem. Feel free to submit a PR!
Great, I’ll make a PR soon-ish!