|
@@ -19,11 +19,10 @@ class StatsConsumerListener
|
|
}
|
|
}
|
|
|
|
|
|
public function run(){
|
|
public function run(){
|
|
- echo 'Running listener';
|
|
|
|
|
|
+ echo 'Running listener'.PHP_EOL;
|
|
|
|
|
|
$callbackMessage = function($msg) {
|
|
$callbackMessage = function($msg) {
|
|
$msgBody = unserialize($msg->body);
|
|
$msgBody = unserialize($msg->body);
|
|
-
|
|
|
|
if (isset($msgBody['name']) && isset($msgBody['args'])) {
|
|
if (isset($msgBody['name']) && isset($msgBody['args'])) {
|
|
// command name and args
|
|
// command name and args
|
|
$name = $msgBody['name'];
|
|
$name = $msgBody['name'];
|
|
@@ -52,6 +51,7 @@ class StatsConsumerListener
|
|
}
|
|
}
|
|
|
|
|
|
try {
|
|
try {
|
|
|
|
+ echo "Executing the command {$execute}".PHP_EOL;
|
|
$process = new Process($execute);
|
|
$process = new Process($execute);
|
|
$process->setTimeout(60 * 10);
|
|
$process->setTimeout(60 * 10);
|
|
$process->run();
|
|
$process->run();
|
|
@@ -63,14 +63,12 @@ class StatsConsumerListener
|
|
} catch (\Exception $e) {
|
|
} catch (\Exception $e) {
|
|
echo 'KILL COMMAND: ', $e->getMessage(), "\n";
|
|
echo 'KILL COMMAND: ', $e->getMessage(), "\n";
|
|
}
|
|
}
|
|
- return true;
|
|
|
|
}
|
|
}
|
|
|
|
|
|
- return false;
|
|
|
|
};
|
|
};
|
|
|
|
|
|
- $this->channelAMQP->queue_declare('command.stats', false, true ,false, false);
|
|
|
|
- $this->channelAMQP->basic_consume('command.stats', '', false, true, false, false, $callbackMessage);
|
|
|
|
|
|
+ $this->channelAMQP->queue_declare('command_stats', false, true ,false, false);
|
|
|
|
+ $this->channelAMQP->basic_consume('command_stats', 'command_stats', false, true, false, false, $callbackMessage);
|
|
|
|
|
|
while (count($this->channelAMQP->callbacks)){
|
|
while (count($this->channelAMQP->callbacks)){
|
|
try {
|
|
try {
|