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
Make downloading more robust #22
Conversation
Otherwise random things cause downloading to fail when it might work on a retry.
If multiple threads try to download the same file, then one of them will get an incomplete file since `downloadFile` will return early if the dest exists, which is does while the download is in progress.
|
The package-index is accessed from multiple threads, but usually when that happens it already downloaded all the stuff and has a cache of data. So it's not strictly needed. |
| @@ -112,7 +114,9 @@ public: | |||
| "Translation-%s.%s".format(lang, "%s")); | |||
|
|
|||
| try { | |||
| fname = downloadIfNecessary (rootDir, tmpDir, fullPath); | |||
| synchronized (this) { | |||
| fname = downloadIfNecessary (rootDir, tmpDir, fullPath); | |||
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.
Can we make this to only synchronize if we actually download anything? Because otherwise this will slow down things even if the file is already downloaded and present on disk.
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.
Meh, hardly; the code basically just returns the filename (after checking if it exists) if it's not remote or if it is downloaded already.
If you insist, then I have to look at the filename in debpkgindex.d which makes it more ugly (currently remote file handling is all taken care of in utility methods).
|
On Tue, Sep 20, 2016 at 06:43:37AM -0700, Matthias Klumpp wrote:
(argh, you can't use markdown from email?!?!) Only this If it's so bad to have code which reduces to something like (I can't believe that the overhead is worth worrying about) in the already-downloaded case, then I could set Iain Lane [ iain@orangesquash.org.uk ] |
|
Jap, I forgot that One thing still exists that I would like to know: When does it happen that the package is accessed twice so that the same file is downloaded twice in parallel? That in itself shouldn't happen... |
|
I think I only ever saw it for arch:all packages. Can it happen for those in particular? |
|
Yes, this makes sense for But still, this makes me wonder if we should maybe filter the |
Two things
I'm not sure if the package index is actually accessed by multiple threads - is this bit needed?