#218 Remove item from queue as well when args match

This commit is contained in:
Axel K. 2014-11-10 15:38:58 +01:00
parent 226ec33bb0
commit 6cda08de25

View File

@ -260,11 +260,12 @@ class Resque
// move each item from original queue to temp queue and process it // move each item from original queue to temp queue and process it
$finished = false; $finished = false;
while(!$finished) { while (!$finished) {
$string = self::redis()->rpoplpush($originalQueue, self::redis()->getPrefix() . $tempQueue); $string = self::redis()->rpoplpush($originalQueue, self::redis()->getPrefix() . $tempQueue);
if(!empty($string)) { if (!empty($string)) {
if(self::matchItem($string, $items)) { if(self::matchItem($string, $items)) {
self::redis()->rpop($tempQueue);
$counter++; $counter++;
} else { } else {
self::redis()->rpoplpush($tempQueue, self::redis()->getPrefix() . $requeueQueue); self::redis()->rpoplpush($tempQueue, self::redis()->getPrefix() . $requeueQueue);
@ -276,7 +277,7 @@ class Resque
// move back from temp queue to original queue // move back from temp queue to original queue
$finished = false; $finished = false;
while(!$finished) { while (!$finished) {
$string = self::redis()->rpoplpush($requeueQueue, self::redis()->getPrefix() .$originalQueue); $string = self::redis()->rpoplpush($requeueQueue, self::redis()->getPrefix() .$originalQueue);
if (empty($string)) { if (empty($string)) {
$finished = true; $finished = true;