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
url_downloader: Directly use network cache when downloading data #834
Conversation
Due to how QNetwork handles caching via QNetworkAccessManager and issues it causes, instead directly access the network cache. This includes comparing the Last-Modified header of the URL to what is cached and also use cached data (if availble) when there is an issue downloading the data from the URL. Fixes #825, fixes #829
Codecov Report
@@ Coverage Diff @@
## master #834 +/- ##
==========================================
- Coverage 68.69% 68.63% -0.07%
==========================================
Files 191 191
Lines 6526 6551 +25
==========================================
+ Hits 4483 4496 +13
- Misses 2043 2055 +12
Continue to review full report at Codecov.
|
Codecov Report
@@ Coverage Diff @@
## master #834 +/- ##
==========================================
- Coverage 68.69% 68.56% -0.14%
==========================================
Files 191 191
Lines 6526 6549 +23
==========================================
+ Hits 4483 4490 +7
- Misses 2043 2059 +16
Continue to review full report at Codecov.
|
Hey, could we have tests for this? |
I thought about it and we would need to mock things like |
Ok doesn't look like premock will help us on this. So basically, what would need to be done is pre-populate a cache that is understood by I can add this basing this on the real cache on my system, but it could be prone to breakage down the line if Qt decides to change how it handles the cache internally, including path versioning that it uses and special metadata in the cache file. I'm just not sure it's worth it. |
After some more looking at this, I really don't think it's worth the effort to put in the static caching infrastructure (which would potentially be fragile to Qt changes) in place for testing this small chunk of code. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a small comment. Code makes sense, but I'm not sure how to test it. It does work while I'm offline at least
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since it's so hard to test, but code looks reasonable, I'm ok with landing this and then watching how it behaves in use for a while.
Shall we merge? |
Nobody else has opinion then? Ok, then |
834: url_downloader: Directly use network cache when downloading data r=gerboland a=townsend2010 Due to how QNetwork handles caching via QNetworkAccessManager and issues it causes, instead directly access the network cache. This includes comparing the Last-Modified header of the URL to what is cached and also use cached data (if availble) when there is an issue downloading the data from the URL. Fixes #825, fixes #829 Co-authored-by: Chris Townsend <christopher.townsend@canonical.com>
Build succeeded |
Well, I do have an opinion. 🎵 |
834: url_downloader: Directly use network cache when downloading data r=gerboland a=townsend2010 Due to how QNetwork handles caching via QNetworkAccessManager and issues it causes, instead directly access the network cache. This includes comparing the Last-Modified header of the URL to what is cached and also use cached data (if availble) when there is an issue downloading the data from the URL. Fixes #825, fixes #829 Co-authored-by: Chris Townsend <christopher.townsend@canonical.com>
Due to how QNetwork handles caching via QNetworkAccessManager and issues it
causes, instead directly access the network cache. This includes comparing the
Last-Modified header of the URL to what is cached and also use cached data (if
availble) when there is an issue downloading the data from the URL.
Fixes #825, fixes #829