Prevent problem where repos at the 'bottom' of the dictionary were failing to sync during periods of extended load
This commit is contained in:
parent
9c37804f75
commit
4f4f1a52af
|
@ -1,6 +1,6 @@
|
||||||
#!/usr/bin/python2
|
#!/usr/bin/python2
|
||||||
|
|
||||||
import time, sys, os, errno, logging, signal, copy, select, socket, grp
|
import time, sys, os, errno, logging, signal, copy, select, socket, grp, random
|
||||||
|
|
||||||
daily = 86400
|
daily = 86400
|
||||||
twice_daily = 86400 / 2
|
twice_daily = 86400 / 2
|
||||||
|
@ -634,7 +634,10 @@ def await_command(ear):
|
||||||
logging.error('Could not communicate with arthur over socket.')
|
logging.error('Could not communicate with arthur over socket.')
|
||||||
|
|
||||||
def new_jobs(now):
|
def new_jobs(now):
|
||||||
for current in repos:
|
#To prevent repos at the 'bottom' of the dictionary from getting neglected when mirror is under unusual load (and merlin is running at MAX_JOBS)
|
||||||
|
keys = repos.keys()
|
||||||
|
random.shuffle(keys)
|
||||||
|
for current in keys:
|
||||||
if len(jobs) >= MAX_JOBS:
|
if len(jobs) >= MAX_JOBS:
|
||||||
break
|
break
|
||||||
if now <= repos[current]['last-attempt'] + mintime:
|
if now <= repos[current]['last-attempt'] + mintime:
|
||||||
|
|
Loading…
Reference in New Issue