瀏覽代碼

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

master
Dirk Alders 3 年之前
父節點
當前提交
c9e1e20764
共有 3 個文件被更改,包括 5381 次插入5151 次删除
  1. 5
    1
      __init__.py
  2. 5376
    5150
      _testresults_/unittest.json
  3. 二進制
      _testresults_/unittest.pdf

+ 5
- 1
__init__.py 查看文件

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
文件差異過大導致無法顯示
查看文件


二進制
_testresults_/unittest.pdf 查看文件


Loading…
取消
儲存