no need for max arg on get_update_queue anymore
This commit is contained in:
parent
6cbbf47c4a
commit
d9d63e1660
@ -138,24 +138,17 @@ class Client(object):
|
|||||||
return self.fs.get_version(url, n)
|
return self.fs.get_version(url, n)
|
||||||
|
|
||||||
|
|
||||||
def get_update_queue(self, max=0):
|
def get_update_queue(self):
|
||||||
# results are always sorted by random to avoid piling on single server
|
# results are always sorted by random to avoid piling on single server
|
||||||
|
|
||||||
# first we try to update anything that we've never retrieved
|
# first we try to update anything that we've never retrieved
|
||||||
new = self.db.tracked.find({'next_update':
|
new = self.db.tracked.find({'next_update':
|
||||||
{'$exists': False}}).sort('_random')
|
{'$exists': False}}).sort('_random')
|
||||||
if max:
|
|
||||||
new = new.limit(max)
|
|
||||||
|
|
||||||
queue = list(new)
|
queue = list(new)
|
||||||
|
|
||||||
# pull the rest from those for which next_update is in the past
|
# pull the rest from those for which next_update is in the past
|
||||||
next = self.db.tracked.find({'next_update':
|
next = self.db.tracked.find({'next_update':
|
||||||
{'$lt': datetime.datetime.utcnow()}}).sort('_random')
|
{'$lt': datetime.datetime.utcnow()}}).sort('_random')
|
||||||
if max:
|
|
||||||
max -= len(queue)
|
|
||||||
next = next.limit(max)
|
|
||||||
|
|
||||||
queue.extend(next)
|
queue.extend(next)
|
||||||
|
|
||||||
return queue
|
return queue
|
||||||
|
Loading…
Reference in New Issue
Block a user