Don't throttle downloads for cached files (Closes #3358)

This commit is contained in:
Mathieu Comandon 2021-01-04 16:39:43 -08:00
parent d22e243af2
commit fab3420d9b
2 changed files with 5 additions and 4 deletions

View file

@ -23,13 +23,13 @@ def save_cache_path(path):
def save_to_cache(source, destination):
"""Copy a file or folder to the cache"""
if not source:
raise ValueError("No source given to save")
raise ValueError("Missing source")
if os.path.dirname(source) == destination:
logger.info("File is already cached in %s, skipping", destination)
logger.info("Skipping caching of %s, already cached in %s", source, destination)
return
if os.path.isdir(source):
# Copy folder recursively
merge_folders(source, destination)
else:
shutil.copy(source, destination)
logger.debug("Copied %s to cache %s", source, destination)
logger.debug("Cached %s to %s", source, destination)

View file

@ -41,7 +41,7 @@ class InstallerFilesBox(Gtk.ListBox):
started_downloads = 0
for file_id in self.installer_files_boxes:
started_downloads += 1
if started_downloads <= self.max_downloads:
if started_downloads <= self.max_downloads or self.installer_files_boxes[file_id].provider == "pga":
self.installer_files_boxes[file_id].start()
else:
self._file_queue.append(file_id)
@ -75,6 +75,7 @@ class InstallerFilesBox(Gtk.ListBox):
def on_file_available(self, widget):
"""A new file is available"""
file_id = widget.installer_file.id
logger.debug("%s is available", file_id)
self.available_files.add(file_id)
if self._file_queue:
next_file_id = self._file_queue.pop()