Skip to content

Commit 7e98d52

Browse files
committed
FEATURE: Implement countReserved, countFailed and countReady
Comply with next major doctrine-common QueueInterface
1 parent c5045ee commit 7e98d52

File tree

1 file changed

+29
-2
lines changed

1 file changed

+29
-2
lines changed

Classes/Queue/RedisQueue.php

Lines changed: 29 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -193,14 +193,41 @@ public function peek($limit = 1)
193193
/**
194194
* @inheritdoc
195195
*/
196-
public function count()
196+
public function count():int
197+
{
198+
return $this->countReady();
199+
}
200+
201+
/**
202+
* @inheritdoc
203+
*/
204+
public function countReady(): int
197205
{
198206
$this->checkClientConnection();
199207
return $this->client->lLen("queue:{$this->name}:messages");
200208
}
201209

210+
/**
211+
* @inheritdoc
212+
*/
213+
public function countReserved(): int
214+
{
215+
$this->checkClientConnection();
216+
return $this->client->lLen("queue:{$this->name}:processing");
217+
}
218+
219+
/**
220+
* @inheritdoc
221+
*/
222+
public function countFailed(): int
223+
{
224+
$this->checkClientConnection();
225+
return $this->client->lLen("queue:{$this->name}:failed");
226+
}
227+
202228
/**
203229
* @return void
230+
* @throws JobQueueException
204231
*/
205232
public function setUp()
206233
{
@@ -279,4 +306,4 @@ protected function connectClient()
279306
}
280307
return $connected;
281308
}
282-
}
309+
}

0 commit comments

Comments
 (0)