瀏覽代碼

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


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


Loading…
取消
儲存