Skip to content

Commit 97c8415

Browse files
daniellienertBastian Waidelich
authored andcommitted
FEATURE: Implement countReserved, countFailed and countReady (#9)
Comply with next major doctrine-common QueueInterface
1 parent c5045ee commit 97c8415

File tree

2 files changed

+22
-3
lines changed

2 files changed

+22
-3
lines changed

Classes/Queue/RedisQueue.php

Lines changed: 21 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,33 @@ public function peek($limit = 1)
193193
/**
194194
* @inheritdoc
195195
*/
196-
public function count()
196+
public function countReady(): int
197197
{
198198
$this->checkClientConnection();
199199
return $this->client->lLen("queue:{$this->name}:messages");
200200
}
201201

202+
/**
203+
* @inheritdoc
204+
*/
205+
public function countReserved(): int
206+
{
207+
$this->checkClientConnection();
208+
return $this->client->lLen("queue:{$this->name}:processing");
209+
}
210+
211+
/**
212+
* @inheritdoc
213+
*/
214+
public function countFailed(): int
215+
{
216+
$this->checkClientConnection();
217+
return $this->client->lLen("queue:{$this->name}:failed");
218+
}
219+
202220
/**
203221
* @return void
222+
* @throws JobQueueException
204223
*/
205224
public function setUp()
206225
{
@@ -279,4 +298,4 @@ protected function connectClient()
279298
}
280299
return $connected;
281300
}
282-
}
301+
}

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"license": "MIT",
66
"require": {
77
"ext-redis": "*",
8-
"flowpack/jobqueue-common": "^2.0"
8+
"flowpack/jobqueue-common": "^3.0 || dev-master"
99
},
1010
"autoload": {
1111
"psr-4": {

0 commit comments

Comments
 (0)