-
-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Two methods added to AMQPConnection: #89
Conversation
+ attachSignal - setup signal handler + detachSignal - setup default handler What is this slight modification about? Worker/Cosumer listens for messages. I'd like to have a possibility to check current status of the script. Thanks to that modification, I can declare my own callback which performs desirable action in response to signal ex. SIGUSR1. I can't do it with pcntl extension (consume is blocking method). This neat feature makes administrative work a bit easier.
Can you specify which exact problem does it solve? Maybe some demo, etc.? P.S.: and I guess the extension will be broken if no pcntl extension loaded first. |
Example problems:
Quick code (may have errors):
|
P.S.: and I guess the extension will be broken if no pcntl extension loaded first. Could you explain it a bit more? :) |
My bad, I was confused with |
In fact, I can't understand how does it works (sorry), can you explain (here or by mail)? |
Ok. I will write more detailed email to you, this evening :) |
Am I right that you simply use raw C |
Yep. |
I guess such signal handling shouldn't be in |
According to Zend signal: https://wiki.php.net/rfc/zendsignals. I see: So, my solution is not so bas I think. It could be in separate extension but my question is "Creating extension for two functions only have any sense?". I had contact with two other firms which have this problem too (no possibility to check current status). There is detach function so if anyone will have problem with that, can remove the handler. |
What you've done is awesome, but as a separate extension it gives support for those who need it. Note, that proctitle extension also provides few functions (on php5.5 it doesn't work properly for now). I'm not one of those who make decision on include or reject modification, but I have to say that having weirdly designed application support in generic extension is not a good practice. |
Example problem: From the experience we know that we cannot foresee every efficiency related problem. What if one of our workers is simply killing database (someone i.e Developer wrote terrible SQL statement!)? Would it be a good idea to have possibility to check current status of the worker? Yes, indeed. Thanks to that slight modification you'll be able to check what is happening in worker's flesh :) |
The pic is great and the idea is awesome, but this changes has nothing related to amqp. Your changes bypass PHP signal handling mechanism, that's all. Such changes are too general to be included in every extension that doing blocking read/write. As I note above, this MAY be a separate extension (experimental only) and probably other users will found it useful, incl. myself. |
What is this slight modification about?
Worker/Cosumer listens for messages. I'd like to have a possibility to
check current status of the script.
Thanks to that modification, I can declare my own callback which
performs desirable action in response to signal ex. SIGUSR1.
I can't do it with pcntl extension (consume is blocking method).
This neat feature makes administrative work a bit easier.