Merge pull request #1080 from croneter/fix-indexerror

Fix IndexError
This commit is contained in:
croneter 2019-12-08 16:47:52 +01:00 committed by GitHub
commit 3fa067aca6
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -284,7 +284,10 @@ class OrderedQueue(Queue.PriorityQueue, object):
super(OrderedQueue, self).__init__(maxsize)
def _qsize(self, len=len):
return len(self.queue) if self.queue[0][0] == self.next_index else 0
try:
return len(self.queue) if self.queue[0][0] == self.next_index else 0
except IndexError:
return 0
def _get(self, heappop=heapq.heappop):
self.next_index += 1