Browse Source

Release d03c7bd799; BugFix for threaded queue (multiple jobs wit identical priority)

master
Dirk Alders 4 years ago
parent
commit
c9e1e20764
3 changed files with 5381 additions and 5151 deletions
  1. 5
    1
      __init__.py
  2. 5376
    5150
      _testresults_/unittest.json
  3. BIN
      _testresults_/unittest.pdf

+ 5
- 1
__init__.py View File

@@ -70,6 +70,7 @@ class queue(object):
70 70
     """
71 71
     class job(object):
72 72
         def __init__(self, priority, callback, *args, **kwargs):
73
+            self.time = time.time()
73 74
             self.priority = priority
74 75
             self.callback = callback
75 76
             self.args = args
@@ -79,7 +80,10 @@ class queue(object):
79 80
             self.callback(queue, *self.args, **self.kwargs)
80 81
 
81 82
         def __lt__(self, other):
82
-            return self.priority < other.priority
83
+            if self.priority != other.priority:
84
+                return self.priority < other.priority
85
+            else:
86
+                return self.time < other.time
83 87
 
84 88
     def __init__(self, expire=True):
85 89
         self.__expire = expire

+ 5376
- 5150
_testresults_/unittest.json
File diff suppressed because it is too large
View File


BIN
_testresults_/unittest.pdf View File


Loading…
Cancel
Save