[MediaWiki-commits] [Gerrit] Recycle jobs to the front of the queue instead of the back - change (mediawiki...jobrunner)
jenkins-bot has submitted this change and it was merged. Change subject: Recycle jobs to the front of the queue instead of the back .. Recycle jobs to the front of the queue instead of the back * This is better if the queue is temporally very long * Also made sure retry comparison is for numbers in case double digit values are at play (default is 3 though). Change-Id: I068ea456f86e70210080cb654278d712db167cd3 --- M redisJobChronService 1 file changed, 4 insertions(+), 4 deletions(-) Approvals: Gilles: Looks good to me, approved jenkins-bot: Verified diff --git a/redisJobChronService b/redisJobChronService index 98bd08d..0e3d0de 100755 --- a/redisJobChronService +++ b/redisJobChronService @@ -451,7 +451,7 @@ public static function getChronScript() { static $script = LUA - local kClaimed, kAttempts, kUnclaimed, kData, kAbandoned, kDelayed = unpack(KEYS) + local kClaimed, kAttempts, kUnclaimed, kData, kAbandoned, kDelayed = unpack(KEYS) local rClaimCutoff, rPruneCutoff, rAttempts, rTime = unpack(ARGV) local released,abandoned,pruned,undelayed,ready = 0,0,0,0,0 -- Short-circuit if there is nothing at all in the queue @@ -463,10 +463,10 @@ local staleClaims = redis.call('zRangeByScore',kClaimed,0,rClaimCutoff) for k,id in ipairs(staleClaims) do local timestamp = redis.call('zScore',kClaimed,id) - local attempts = redis.call('hGet',kAttempts,id) - if attempts rAttempts then + local attempts = 1*redis.call('hGet',kAttempts,id) + if attempts 1*rAttempts then -- Claim expired and attempts left: re-enqueue the job - redis.call('lPush',kUnclaimed,id) + redis.call('rPush',kUnclaimed,id) released = released + 1 else -- Claim expired and no attempts left: mark the job as dead -- To view, visit https://gerrit.wikimedia.org/r/226891 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: merged Gerrit-Change-Id: I068ea456f86e70210080cb654278d712db167cd3 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/jobrunner Gerrit-Branch: master Gerrit-Owner: Aaron Schulz asch...@wikimedia.org Gerrit-Reviewer: Gilles gdu...@wikimedia.org Gerrit-Reviewer: jenkins-bot ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits
[MediaWiki-commits] [Gerrit] Recycle jobs to the front of the queue instead of the back - change (mediawiki...jobrunner)
Aaron Schulz has uploaded a new change for review. https://gerrit.wikimedia.org/r/226891 Change subject: Recycle jobs to the front of the queue instead of the back .. Recycle jobs to the front of the queue instead of the back * This is better if the queue is temporally very long * Also made sure retry comparison is for numbers in case double digit values are at play (default is 3 though). Change-Id: I068ea456f86e70210080cb654278d712db167cd3 --- M redisJobChronService 1 file changed, 4 insertions(+), 4 deletions(-) git pull ssh://gerrit.wikimedia.org:29418/mediawiki/services/jobrunner refs/changes/91/226891/1 diff --git a/redisJobChronService b/redisJobChronService index 98bd08d..0e3d0de 100755 --- a/redisJobChronService +++ b/redisJobChronService @@ -451,7 +451,7 @@ public static function getChronScript() { static $script = LUA - local kClaimed, kAttempts, kUnclaimed, kData, kAbandoned, kDelayed = unpack(KEYS) + local kClaimed, kAttempts, kUnclaimed, kData, kAbandoned, kDelayed = unpack(KEYS) local rClaimCutoff, rPruneCutoff, rAttempts, rTime = unpack(ARGV) local released,abandoned,pruned,undelayed,ready = 0,0,0,0,0 -- Short-circuit if there is nothing at all in the queue @@ -463,10 +463,10 @@ local staleClaims = redis.call('zRangeByScore',kClaimed,0,rClaimCutoff) for k,id in ipairs(staleClaims) do local timestamp = redis.call('zScore',kClaimed,id) - local attempts = redis.call('hGet',kAttempts,id) - if attempts rAttempts then + local attempts = 1*redis.call('hGet',kAttempts,id) + if attempts 1*rAttempts then -- Claim expired and attempts left: re-enqueue the job - redis.call('lPush',kUnclaimed,id) + redis.call('rPush',kUnclaimed,id) released = released + 1 else -- Claim expired and no attempts left: mark the job as dead -- To view, visit https://gerrit.wikimedia.org/r/226891 To unsubscribe, visit https://gerrit.wikimedia.org/r/settings Gerrit-MessageType: newchange Gerrit-Change-Id: I068ea456f86e70210080cb654278d712db167cd3 Gerrit-PatchSet: 1 Gerrit-Project: mediawiki/services/jobrunner Gerrit-Branch: master Gerrit-Owner: Aaron Schulz asch...@wikimedia.org ___ MediaWiki-commits mailing list MediaWiki-commits@lists.wikimedia.org https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits