We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
At the moment, spatie/async is being used to run the commands in parallel so that the event loop is not blocked as shown in the following example.
<?php namespace ChessServer\Command\Game\Async; use ChessServer\Command\AbstractAsyncCommand; use ChessServer\Socket\AbstractSocket; class ExtractCommand extends AbstractAsyncCommand { public function __construct() { $this->name = '/extract'; $this->description = 'Extracts oscillations data from a game.'; $this->params = [ 'params' => '<string>', ]; } public function validate(array $argv) { return count($argv) - 1 === count($this->params); } public function run(AbstractSocket $socket, array $argv, int $id) { $params = json_decode(stripslashes($argv[1]), true); $this->pool->add(new ExtractTask($params)) ->then(function ($result) use ($socket, $id) { return $socket->getClientStorage()->send([$id], [ $this->name => $result, ]); }); } }
However, with the current implementation of the command line interface, log messages are not being written into the log files.
A call to the wait() method needs to be made in order for the messages to be logged in the development environment.
wait()
<?php namespace ChessServer\Command\Game\Async; use ChessServer\Command\AbstractAsyncCommand; use ChessServer\Socket\AbstractSocket; class ExtractCommand extends AbstractAsyncCommand { public function __construct() { $this->name = '/extract'; $this->description = 'Extracts oscillations data from a game.'; $this->params = [ 'params' => '<string>', ]; } public function validate(array $argv) { return count($argv) - 1 === count($this->params); } public function run(AbstractSocket $socket, array $argv, int $id) { $params = json_decode(stripslashes($argv[1]), true); $this->pool->add(new ExtractTask($params)) ->then(function ($result) use ($socket, $id) { return $socket->getClientStorage()->send([$id], [ $this->name => $result, ]); }); $this->pool->wait(); } }
The thing is the call to the wait() method needs to be removed for the staging server not to block the event loop.
The text was updated successfully, but these errors were encountered:
No branches or pull requests
At the moment, spatie/async is being used to run the commands in parallel so that the event loop is not blocked as shown in the following example.
However, with the current implementation of the command line interface, log messages are not being written into the log files.
A call to the
wait()
method needs to be made in order for the messages to be logged in the development environment.The thing is the call to the
wait()
method needs to be removed for the staging server not to block the event loop.The text was updated successfully, but these errors were encountered: