Skip to content

Commit 0b00d81

Browse files
committed
backport fix
1 parent a4885e6 commit 0b00d81

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

src/Illuminate/Queue/LuaScripts.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ public static function migrateExpiredJobs()
117117
for i = 1, #val, 100 do
118118
redis.call('rpush', KEYS[2], unpack(val, i, math.min(i+99, #val)))
119119
-- Push a notification for every job that was migrated...
120-
for j = 1, math.min(i+99, #val) do
120+
for j = i, math.min(i+99, #val) do
121121
redis.call('rpush', KEYS[3], 1)
122122
end
123123
end

tests/Queue/RedisQueueIntegrationTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,23 @@ public function testBlockingPop($driver)
9090
}
9191
}
9292

93+
/**
94+
* @dataProvider redisDriverProvider
95+
*
96+
* @param string $driver
97+
*/
98+
public function testMigrateMoreThan100Jobs($driver)
99+
{
100+
$this->setQueue($driver);
101+
for ($i = -1; $i >= -201; $i--) {
102+
$this->queue->later($i, new RedisQueueIntegrationTestJob($i));
103+
}
104+
for ($i = -201; $i <= -1; $i++) {
105+
$this->assertEquals($i, unserialize(json_decode($this->queue->pop()->getRawBody())->data->command)->i);
106+
$this->assertEquals(-$i - 1, $this->redis[$driver]->llen('queues:default:notify'));
107+
}
108+
}
109+
93110
/**
94111
* @dataProvider redisDriverProvider
95112
*

0 commit comments

Comments
 (0)