Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid making multiple requests to the same URL? #221

Closed
guihkx opened this issue Mar 26, 2023 · 2 comments
Closed

Avoid making multiple requests to the same URL? #221

guihkx opened this issue Mar 26, 2023 · 2 comments

Comments

@guihkx
Copy link

guihkx commented Mar 26, 2023

If one or more entries share the exact same url attribute, would it be possible for nvchecker to only make a single HTTP request to that URL and then share/reuse that response body among other entries? Here's a practical example:

This page from NVIDIA's website lists a lot of driver versions, so let's suppose I want to monitor some of these versions.

My nvchecker config file would look like this:

[__config__]
oldver = "nvidia-old.json"
newver = "nvidia-new.json"

[NVIDIA_Production]
source = "regex"
regex = "Latest Production Branch Version: <a .+?>([\\d.]+)</a>"
url = "https://www.nvidia.com/en-us/drivers/unix/"

[NVIDIA_Latest]
source = "regex"
regex = "Latest New Feature Branch Version: <a .+?>([\\d.]+)</a>"
url = "https://www.nvidia.com/en-us/drivers/unix/"

[NVIDIA_Beta]
source = "regex"
regex = "Latest Beta Version: <a .+?>([\\d.]+)</a>"
url = "https://www.nvidia.com/en-us/drivers/unix/"

As you can see, these entries share the exact same URL. However, upon running nvchecker using that config, three distinct HTTP requests will be made to the exact same page:

$ nvchecker -c nvidia.toml -l debug
[D 03-26 05:52:10.320 selector_events:54] Using selector: EpollSelector
[D 03-26 05:52:10.322 curl_httpclient:516] GET https://www.nvidia.com/en-us/drivers/unix/
[D 03-26 05:52:10.322 curl_httpclient:516] GET https://www.nvidia.com/en-us/drivers/unix/
[D 03-26 05:52:10.323 curl_httpclient:516] GET https://www.nvidia.com/en-us/drivers/unix/
...

(I'm sorry if this is already possible using current options, but I couldn't find any)

@lilydjwg
Copy link
Owner

Good point, implemented!

@guihkx
Copy link
Author

guihkx commented Mar 26, 2023

Oh my, that was fast! Thank you so much!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants