dmunozv04 / iSponsorBlockTV

SponsorBlock client for all YouTube TV clients.
GNU General Public License v3.0
2.18k stars 90 forks source link

Reduce dns requests with cache #97

Open adriadam10 opened 8 months ago

adriadam10 commented 8 months ago

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. image image

Describe the solution you'd like It would be great some kind of dns caching to stop this "bombing".

adriadam10 commented 8 months ago

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 image

dmunozv04 commented 8 months ago

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?

FabioGNR commented 8 months ago

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!

dmunozv04 commented 8 months ago

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!