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

add pcntl_signal_dispatch after job finish for php extension #485

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
1 change: 1 addition & 0 deletions src/cli/VerboseBehavior.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ public function beforeExec(ExecEvent $event)
$this->command->stdout($this->jobTitle($event), Console::FG_GREY);
$this->command->stdout(' - ', Console::FG_YELLOW);
$this->command->stdout('Started', Console::FG_GREEN);
$this->command->stdout(' (params:' . json_encode($event->job, JSON_UNESCAPED_UNICODE) . ')');
$this->command->stdout(PHP_EOL);
}

Expand Down
6 changes: 4 additions & 2 deletions src/drivers/amqp_interop/Queue.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
use Interop\Amqp\AmqpQueue;
use Interop\Amqp\AmqpTopic;
use Interop\Amqp\Impl\AmqpBind;
use Yii;
use yii\base\Application as BaseApp;
use yii\base\Event;
use yii\base\NotSupportedException;
Expand Down Expand Up @@ -295,8 +296,7 @@ public function init()
$oldHandler($signal);
}

pcntl_signal($signal, SIG_DFL);
posix_kill(posix_getpid(), $signal);
Yii::$app->end();
});
}
}
Expand All @@ -314,6 +314,7 @@ public function listen()
$consumer = $this->context->createConsumer($queue);

$callback = function (AmqpMessage $message, AmqpConsumer $consumer) {
pcntl_signal_dispatch();
if ($message->isRedelivered()) {
$consumer->acknowledge($message);

Expand All @@ -332,6 +333,7 @@ public function listen()

$this->redeliver($message);
}
pcntl_signal_dispatch();

return true;
};
Expand Down
Loading