Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix some issues with the download refactoring in Spices.py (#7549)
* Spices.py: use `with lock` instead of `lock.acquire` to ensure a lock always gets removed * Spices.py: updaate progress: only use the total downloads to calculate the fraction when there is more than one This prevents a divide-by-zero under certain circumstances, and gives more meaningfull progress information. * Spices.py: add a timeout to urlopen to prevent a hang when the connection is interrupted mid-download * Spices.py: don't open a file stream until we're ready, and use the with operator to ensure that we don't leak file descriptors
- Loading branch information
Showing
1 changed file
with
31 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters