Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

!!! FEATURE: Extend the QueueInterface with countReserved and countFailed #29

Merged
merged 4 commits into from
May 30, 2018

Conversation

daniellienert
Copy link
Contributor

Also add countReady() and deprecate the count() command
to clearify the interface

@daniellienert daniellienert requested a review from kdambekalns May 28, 2018 20:25
@daniellienert daniellienert force-pushed the feature/extend-interface branch from 5c30e18 to 2eb3fa4 Compare May 28, 2018 20:26
@daniellienert daniellienert changed the title FEATURE: Extend the countReserved and countFailed FEATURE: Extend the QueueInterface with countReserved and countFailed May 28, 2018
@daniellienert daniellienert requested a review from bwaidelich May 28, 2018 20:37
Also add countReady() and deprecate the count() command
to clearify the interface
@daniellienert daniellienert force-pushed the feature/extend-interface branch from 2eb3fa4 to 5a9ab5e Compare May 28, 2018 20:38
Copy link
Member

@kdambekalns kdambekalns left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me…

Copy link
Contributor

@bwaidelich bwaidelich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a very useful addition, thank you!
But we should mark it breaking so that it does not end up in a minor update.
Besides I think we should have the corresponding PRs for the 3 implementations ready before we merge this one. I'm happy to help with that.
Lastly I don't think that we need to keep the count() method in the QueueInterface

@@ -40,14 +42,15 @@ class QueueCommandController extends CommandController
* Displays all configured queues, their type and the number of messages that are ready to be processed.
*
* @return void
* @throws Exception
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Our CGL don't state anything about the requirement of @throws annotations. Personally I'm strongly against those.
Obviously no reason to block this, but if we decide to add the annotations we should do it for the whole package, and maybe in a separate PR

use Flowpack\JobQueue\Common\Queue\QueueManager;
use Neos\Flow\Annotations as Flow;
use Neos\Flow\Cli\CommandController;
use Neos\Flow\Mvc\Exception\StopActionException;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this namespace imported?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nevermind, it's needed for the @throws annotations below

* @return int The number of ready messages in the queue
* @deprecated Will be removed with the next major. Use countReady instead.
*/
public function count(): int;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we change the interface we don't need to keep deprecated methods IMO as the implementations need to be adjusted anyways

public function countFailedReturnsZeroByDefault()
{
$this->assertSame(0, $this->queue->countFailed());
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should add tests effectively covering the new features:
countFailedReturnsNumberOfFailedMessages() and countReservedReturnsNumberOfReservedMessages()

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added with bdffb4a

@daniellienert daniellienert changed the title FEATURE: Extend the QueueInterface with countReserved and countFailed !!! FEATURE: Extend the QueueInterface with countReserved and countFailed May 29, 2018
bwaidelich added a commit to bwaidelich/jobqueue-beanstalkd that referenced this pull request May 29, 2018
Comply with next major doctrine-common QueueInterface
(see corresponding Pull Request: Flowpack/jobqueue-common#29)
Copy link
Contributor

@bwaidelich bwaidelich left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@daniellienert I adjusted the beanstalkd implementation (Flowpack/jobqueue-beanstalkd#11), added some functional tests covering the new features and tested it successfully with all our three implementations!

PS: I'm still opposed to introducing the @throws annotations (at least if we don't do it for all packages) and the new methods are the only ones with return types now. But those are nitpicks of course!

@daniellienert
Copy link
Contributor Author

daniellienert commented May 30, 2018

@bwaidelich: Thanks a lot!
For the @throws: lets find a common approach in discuss and adapt the code if needed.
For the return types: I think it would be good to change the complete interface to use return types - as it is also breaking - before releasing a new major. But I didn't want to make this PR too big.

@daniellienert daniellienert merged commit acb68e9 into Flowpack:master May 30, 2018
@daniellienert daniellienert deleted the feature/extend-interface branch May 30, 2018 07:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants