From: Aaron Schulz Date: Mon, 1 Apr 2013 19:36:19 +0000 (-0700) Subject: [JobQueue] Fixed use of ipairs() in JobQueueRedis. X-Git-Tag: 1.31.0-rc.0~20140 X-Git-Url: http://git.cyclocoop.org/data/%27%20.%20mediabox_timestamp%28find_in_path%28%27javascript/%7B%24www_url%7Dadmin/compta/operations/%40%20%27info_etape_suivante_2%27%20=%3E%20%27You%20can%20move%20on%20to%20the%20next%20step.%27%2C%20%27info_exceptions_proxy%27%20=%3E%20%27Exceptions%20for%20the%20proxy%27%2C%20%27info_exportation_base%27%20=%3E%20%27export%20database%20to%20%40archive%40%27%2C-%27info_facilite_suivi_activite%27%20=%3E%20%27To%20simplify%20monitoring%20of%20the%20site/%27s%20editorial;-%20%20activities%2C%20SPIP%20can%20send%20rmail%20notifications%2C%20e.g.%20to%20an%20editors/%27.%28%24current%20%3E%202?a=commitdiff_plain;h=32d063ac2a7ebb75a86c44408f94a40fcf15cfa2;p=lhc%2Fweb%2Fwiklou.git [JobQueue] Fixed use of ipairs() in JobQueueRedis. Change-Id: Id507c0a3dfaf8b1fde92eb99f7204e31775b042c --- diff --git a/includes/job/JobQueueRedis.php b/includes/job/JobQueueRedis.php index d0901ef62e..c57081e77f 100644 --- a/includes/job/JobQueueRedis.php +++ b/includes/job/JobQueueRedis.php @@ -615,8 +615,9 @@ LUA; local released,abandoned,pruned = 0,0,0 -- Get all non-dead jobs that have an expired claim on them. -- The score for each item is the last claim timestamp (UNIX). - local staleClaims = redis.call('zRangeByScore',KEYS[1],0,ARGV[1],'WITHSCORES') - for id,timestamp in ipairs(staleClaims) do + local staleClaims = redis.call('zRangeByScore',KEYS[1],0,ARGV[1]) + for k,id in ipairs(staleClaims) do + local timestamp = redis.call('zScore',KEYS[1],id) local attempts = redis.call('hGet',KEYS[2],id) if attempts < ARGV[3] then -- Claim expired and retries left: re-enqueue the job @@ -632,8 +633,8 @@ LUA; end -- Get all of the dead jobs that have been marked as dead for too long. -- The score for each item is the last claim timestamp (UNIX). - local deadClaims = redis.call('zRangeByScore',KEYS[5],0,ARGV[2],'WITHSCORES') - for id,timestamp in ipairs(deadClaims) do + local deadClaims = redis.call('zRangeByScore',KEYS[5],0,ARGV[2]) + for k,id in ipairs(deadClaims) do -- Stale and out of retries: remove any traces of the job redis.call('zRem',KEYS[5],id) redis.call('hDel',KEYS[2],id)