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
     """
70
     """
71
     class job(object):
71
     class job(object):
72
         def __init__(self, priority, callback, *args, **kwargs):
72
         def __init__(self, priority, callback, *args, **kwargs):
73
+            self.time = time.time()
73
             self.priority = priority
74
             self.priority = priority
74
             self.callback = callback
75
             self.callback = callback
75
             self.args = args
76
             self.args = args
79
             self.callback(queue, *self.args, **self.kwargs)
80
             self.callback(queue, *self.args, **self.kwargs)
80
 
81
 
81
         def __lt__(self, other):
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
     def __init__(self, expire=True):
88
     def __init__(self, expire=True):
85
         self.__expire = expire
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