X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Fpoolcounter%2FPoolCounterRedis.php;h=2b37b0b747ee78a237a91917824ceedbd477d56c;hb=e016f6aa9386f515398d07d25419650c1fb74bf6;hp=36101e02cd6dd034c384a2cbdbdba16a35c4cf03;hpb=9e6e407dc97626412e4531de254daac75498d0ba;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/poolcounter/PoolCounterRedis.php b/includes/poolcounter/PoolCounterRedis.php index 36101e02cd..2b37b0b747 100644 --- a/includes/poolcounter/PoolCounterRedis.php +++ b/includes/poolcounter/PoolCounterRedis.php @@ -45,7 +45,7 @@ * Also this should be on a server plenty of RAM for the working set to avoid evictions. * Evictions could temporarily allow wait queues to double in size or temporarily cause * pools to appear as full when they are not. Using volatile-ttl and bumping memory-samples - * and redis.conf can be helpful otherwise. + * in redis.conf can be helpful otherwise. * * @ingroup Redis * @since 1.23 @@ -154,8 +154,12 @@ class PoolCounterRedis extends PoolCounter { if rSlot ~= 'w' and redis.call('exists',kSlotsNextRelease) == 1 then if 1*redis.call('zScore',kSlotsNextRelease,rSlot) ~= (rSlotTime + rExpiry) then -- Slot lock expired and was released already - elseif redis.call('lLen',kSlots) >= (1*rMaxWorkers - 1) then - -- Clear list to save space; it will re-init as needed + elseif redis.call('lLen',kSlots) >= 1*rMaxWorkers then + -- Slots somehow got out of sync; reset the list for sanity + redis.call('del',kSlots,kSlotsNextRelease) + elseif redis.call('lLen',kSlots) == (1*rMaxWorkers - 1) and redis.call('zCard',kWaiting) == 0 then + -- Slot list will be made full; clear it to save space (it re-inits as needed) + -- since nothing is waiting on being unblocked by a push to the list redis.call('del',kSlots,kSlotsNextRelease) else -- Add slot back to pool and update the "next release" time @@ -406,7 +410,8 @@ LUA; if ( $poolCounter->slot !== null ) { $poolCounter->release(); } - } catch ( Exception $e ) {} + } catch ( Exception $e ) { + } } } }