diff --git a/merlin/merlin.py b/merlin/merlin.py index cd6fb06..0099a6e 100755 --- a/merlin/merlin.py +++ b/merlin/merlin.py @@ -1,6 +1,6 @@ #!/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 twice_daily = 86400 / 2 @@ -634,7 +634,10 @@ def await_command(ear): logging.error('Could not communicate with arthur over socket.') 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: break if now <= repos[current]['last-attempt'] + mintime: