-
Notifications
You must be signed in to change notification settings - Fork 123
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
Proper reaction for SIGTERM and SIGINT #177
Conversation
@ddeboer WDYT? |
@Baachi Hi. What is your decision? |
@igormukhingmailcom I think this makes sense. Classes have been moved due to a switch to PSR-4, so could you please rebase your PR on master? Thanks! |
$this->shouldStop = false; | ||
if (is_callable('pcntl_signal')) { | ||
pcntl_signal(SIGTERM, array($this, 'stop')); | ||
pcntl_signal(SIGINT, array($this, 'stop')); |
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.
If you like, you can use [ ... ]
here, as this lib now requires PHP 5.4.
Looks like rebased successfully. But I totally unsure if I break all or not. Doing this first time... I've used igor@toshiba-pc:/var/www/opensource/igormukhingmailcom/data-import$ git push origin pcntl
To [email protected]:igormukhingmailcom/data-import.git
! [rejected] pcntl -> pcntl (non-fast-forward)
error: failed to push some refs to '[email protected]:igormukhingmailcom/data-import.git'
hint: Updates were rejected because the tip of your current branch is behind
hint: its remote counterpart. Integrate the remote changes (e.g.
hint: 'git pull ...') before pushing again.
hint: See the 'Note about fast-forwards' in 'git push --help' for details.
igor@toshiba-pc:/var/www/opensource/igormukhingmailcom/data-import$ git push --help
igor@toshiba-pc:/var/www/opensource/igormukhingmailcom/data-import$ git push origin pcntl --force
Counting objects: 28, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (8/8), done.
Writing objects: 100% (8/8), 1.04 KiB | 0 bytes/s, done.
Total 8 (delta 6), reused 0 (delta 0)
To [email protected]:igormukhingmailcom/data-import.git
+ c297225...577a1f8 pcntl -> pcntl (forced update) |
You did it right. After rebasing, a force push is always necessary to overwrite the previous commits. As long as you make sure to only force push in your own branches (never to master) you’ll be fine. Thanks! |
Proper reaction for SIGTERM and SIGINT
I find this PR a little bit odd. Why is it necessary? Killing the process is not enough? |
It is enough to stop the import, but with this PR you can still get the result from a stopped import. |
I see. My other problem is that the PCNTL extension availability is checked through I would add a constant instead:
and check this instead. It is way much faster. |
That at this time compatible with PHP 5.3 and graceful degradation for running on Windows