[Reproducible-commits] [diffoscope] 15/17: use starmap when only one worker

Jérémy Bobbio lunar at moszumanska.debian.org
Tue Dec 8 18:15:22 UTC 2015


This is an automated email from the git hooks/post-receive script.

lunar pushed a commit to branch pu/parallel2
in repository diffoscope.

commit 1fde89d55e8f3ad7ae72bea41a4763f6117abab2
Author: Jérémy Bobbio <lunar at debian.org>
Date:   Tue Dec 8 18:52:00 2015 +0100

    use starmap when only one worker
---
 diffoscope/comparators/utils.py | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/diffoscope/comparators/utils.py b/diffoscope/comparators/utils.py
index a07c12c..f3871d4 100644
--- a/diffoscope/comparators/utils.py
+++ b/diffoscope/comparators/utils.py
@@ -209,7 +209,12 @@ class Container(object, metaclass=ABCMeta):
                 yield NonExistingFile('/dev/null', other_file), other_file, NO_NOTIFICATION
 
     def compare(self, other, source=None):
-        return [FutureDifference(Config.general.executor.submit(diffoscope.comparators.compare_files_with_notification, *args)) for args in self.comparisons(other)]
+        if Config.general.max_workers > 1:
+            logger.warning('multi')
+            return [FutureDifference(Config.general.executor.submit(diffoscope.comparators.compare_files_with_notification, *args)) for args in self.comparisons(other)]
+        else:
+            logger.warning('single')
+            return starmap(diffoscope.comparators.compare_files_with_notification, self.comparisons(other))
 
 
 class ArchiveMember(File):

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/diffoscope.git



More information about the Reproducible-commits mailing list