-
-
Notifications
You must be signed in to change notification settings - Fork 116
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
Make it possible to specify a new queue instance #27
Conversation
Note that this is the approach https://github.com/reactphp/promise/blob/master/src/functions.php#L203 |
Any thoughts on this @mtdowling? It would be great for optimisation where the curl handler isn't being used. |
This should be ok considering it would be an application concern to modify this. Do you think it would be better to introduce an interface here? |
Probably, yes. Would you like me to add one? |
That would be great! |
I've added an interface. The only question in my mind was whether |
What are your thoughts on this @mtdowling? We've been using this in production for a while and it's been working well for us. Referencing a fork branch in our Composer configs is getting pretty tricky however. |
* | ||
* Note: This shutdown will occur before any destructors are triggered. | ||
*/ | ||
public function disableShutdown(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if this should just be an implementation detail of the default TaskQueue
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had the same thought. However, would this not be a breaking change? (E.g. queue()->disableShutdown()
would potentially no longer work.)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think anyone calling that method has already coupled themselves to a specific implementation detail though... I would be in favor of removing this from the interface but keeping it on the TaskQueue class.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How do you feel about merging this if I update the PR to remove disableShutdown()
from TaskQueueInterface
? Requiring this forked version in our code base is getting more and more tricky.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes. Removing this from the interface is the right direction in my opinion. Will be merged after.
@mtdowling I've removed P.S. Thanks for your responsiveness here and in general, I really appreciate it. |
Thanks! This looks great. |
In order to enable efficient integrations with reactors, it would be very helpful to be able to provide a custom task queue.
Here's a simple example of what would be possible after merging this PR:
Simply calling
$reactor->immedately($task);
would really be preferable but, unfortunately, this would prevent therun()
andisEmpty()
methods from working as expected.