[meld] matchers.helpers: Stop using JoinableQueue; we weren't joining it



commit c9d2e8f8c3beeb3f507e8999ca44352f7ac1f553
Author: Kai Willadsen <kai willadsen gmail com>
Date:   Mon Jan 29 08:07:10 2018 +1000

    matchers.helpers: Stop using JoinableQueue; we weren't joining it
    
    I'm almost certain that we were only using JoinableQueue because the
    threading-based implementation used task_done() because it was there and
    seemed sensible. Since we never actually join it, there's really no
    reason to keep this around.

 meld/matchers/helpers.py | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
---
diff --git a/meld/matchers/helpers.py b/meld/matchers/helpers.py
index 5f2e15cc..885d3291 100644
--- a/meld/matchers/helpers.py
+++ b/meld/matchers/helpers.py
@@ -35,8 +35,6 @@ class MatcherWorker(multiprocessing.Process):
                 self.results.put((task_id, matcher.get_opcodes()))
             except Exception as e:
                 log.error("Exception while running diff: %s", e)
-            finally:
-                self.tasks.task_done()
             time.sleep(0)
 
 
@@ -58,12 +56,12 @@ class CachedSequenceMatcher(object):
         """
         self.scheduler = scheduler
         self.cache = {}
-        self.tasks = multiprocessing.JoinableQueue()
+        self.tasks = multiprocessing.Queue()
         # Limiting the result queue here has the effect of giving us
         # much better interactivity. Without this limit, the
         # result-checker tends to get starved and all highlights get
         # delayed until we're almost completely finished.
-        self.results = multiprocessing.JoinableQueue(5)
+        self.results = multiprocessing.Queue(5)
         self.thread = MatcherWorker(self.tasks, self.results)
         self.task_id = 1
         self.queued_matches = {}


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]