Skip to content

Commit

Permalink
FEATURE: Implement countReserved, countFailed and countReady (#9)
Browse files Browse the repository at this point in the history
Comply with next major doctrine-common QueueInterface
  • Loading branch information
daniellienert authored and Bastian Waidelich committed May 30, 2018
1 parent c5045ee commit 97c8415
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
23 changes: 21 additions & 2 deletions Classes/Queue/RedisQueue.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,14 +193,33 @@ public function peek($limit = 1)
/**
* @inheritdoc
*/
public function count()
public function countReady(): int
{
$this->checkClientConnection();
return $this->client->lLen("queue:{$this->name}:messages");
}

/**
* @inheritdoc
*/
public function countReserved(): int
{
$this->checkClientConnection();
return $this->client->lLen("queue:{$this->name}:processing");
}

/**
* @inheritdoc
*/
public function countFailed(): int
{
$this->checkClientConnection();
return $this->client->lLen("queue:{$this->name}:failed");
}

/**
* @return void
* @throws JobQueueException
*/
public function setUp()
{
Expand Down Expand Up @@ -279,4 +298,4 @@ protected function connectClient()
}
return $connected;
}
}
}
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"license": "MIT",
"require": {
"ext-redis": "*",
"flowpack/jobqueue-common": "^2.0"
"flowpack/jobqueue-common": "^3.0 || dev-master"
},
"autoload": {
"psr-4": {
Expand Down

0 comments on commit 97c8415

Please sign in to comment.