Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 6a5205e9a1 | |||
| 471f7a92bb | |||
| 429ffe561c | |||
| 27cdf5082f | |||
| 4c3751ca4d |
@@ -31,7 +31,7 @@ defined('TASK_PATH') or define('TASK_PATH', APP_PATH . 'app/Async/');
|
|||||||
defined('LISTENER_PATH') or define('LISTENER_PATH', APP_PATH . 'app/Listener/');
|
defined('LISTENER_PATH') or define('LISTENER_PATH', APP_PATH . 'app/Listener/');
|
||||||
defined('KAFKA_PATH') or define('KAFKA_PATH', APP_PATH . 'app/Kafka/');
|
defined('KAFKA_PATH') or define('KAFKA_PATH', APP_PATH . 'app/Kafka/');
|
||||||
defined('RPC_CLIENT_PATH') or define('RPC_CLIENT_PATH', APP_PATH . 'app/Client/Rpc/');
|
defined('RPC_CLIENT_PATH') or define('RPC_CLIENT_PATH', APP_PATH . 'app/Client/Rpc/');
|
||||||
defined('MODEL_PATH') or define('MODEL_PATH', APP_PATH . 'app/Models/');
|
defined('MODEL_PATH') or define('MODEL_PATH', APP_PATH . 'app/Model/');
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
@@ -220,6 +220,13 @@ class Pool extends Component
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
while (static::$_connections[$name]->length() > 0) {
|
while (static::$_connections[$name]->length() > 0) {
|
||||||
|
if (static::$_connections[$name] instanceof Channel)
|
||||||
|
{
|
||||||
|
if (!Context::inCoroutine())
|
||||||
|
{
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
$client = static::$_connections[$name]->pop();
|
$client = static::$_connections[$name]->pop();
|
||||||
if ($client instanceof StopHeartbeatCheck) {
|
if ($client instanceof StopHeartbeatCheck) {
|
||||||
$client->stopHeartbeatCheck();
|
$client->stopHeartbeatCheck();
|
||||||
|
|||||||
+4
-4
@@ -30,11 +30,11 @@ class Gii
|
|||||||
|
|
||||||
private InputInterface $input;
|
private InputInterface $input;
|
||||||
|
|
||||||
public string $modelPath = APP_PATH . 'app/Models/';
|
public string $modelPath = APP_PATH . 'app/Model/';
|
||||||
public string $modelNamespace = 'App\\Models\\';
|
public string $modelNamespace = 'App\\Model\\';
|
||||||
|
|
||||||
public string $controllerPath = APP_PATH . 'app/Http/Controllers/';
|
public string $controllerPath = APP_PATH . 'app/Http/Controller/';
|
||||||
public string $controllerNamespace = 'App\\Controllers\\';
|
public string $controllerNamespace = 'App\\Controller\\';
|
||||||
|
|
||||||
|
|
||||||
public static array $createSqls = [];
|
public static array $createSqls = [];
|
||||||
|
|||||||
@@ -24,11 +24,11 @@ abstract class GiiBase
|
|||||||
|
|
||||||
protected InputInterface $input;
|
protected InputInterface $input;
|
||||||
|
|
||||||
public string $modelPath = APP_PATH . 'app/Models/';
|
public string $modelPath = APP_PATH . 'app/Model/';
|
||||||
public string $modelNamespace = 'App\Models\\';
|
public string $modelNamespace = 'App\Model\\';
|
||||||
|
|
||||||
public string $controllerPath = APP_PATH . 'app/Http/Controllers/';
|
public string $controllerPath = APP_PATH . 'app/Http/Controller/';
|
||||||
public string $controllerNamespace = 'App\\Controllers\\';
|
public string $controllerNamespace = 'App\\Controller\\';
|
||||||
|
|
||||||
public ?string $module = null;
|
public ?string $module = null;
|
||||||
|
|
||||||
|
|||||||
@@ -92,7 +92,7 @@ use Kiri\Core\Json;
|
|||||||
use Database\Connection;
|
use Database\Connection;
|
||||||
use Database\Annotation\Get;
|
use Database\Annotation\Get;
|
||||||
use Database\Annotation\Set;
|
use Database\Annotation\Set;
|
||||||
use Annotation\Model\Relation;
|
use Database\Relation;
|
||||||
use Database\Model;
|
use Database\Model;
|
||||||
' . PHP_EOL;
|
' . PHP_EOL;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,10 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Kiri\Process;
|
|
||||||
|
|
||||||
interface OnProcessInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
public function handle();
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,88 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Kiri\Process;
|
|
||||||
|
|
||||||
abstract class Process implements OnProcessInterface
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var \Swoole\Process
|
|
||||||
*/
|
|
||||||
protected \Swoole\Process $process;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var mixed
|
|
||||||
*/
|
|
||||||
protected mixed $redirect_stdin_and_stdout = null;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var int
|
|
||||||
*/
|
|
||||||
protected int $pipe_type = SOCK_DGRAM;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
protected bool $enable_coroutine = true;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @var string
|
|
||||||
*/
|
|
||||||
protected string $name = '';
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return \Swoole\Process
|
|
||||||
*/
|
|
||||||
public function getProcess(): \Swoole\Process
|
|
||||||
{
|
|
||||||
return $this->process;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return mixed
|
|
||||||
*/
|
|
||||||
public function getRedirectStdinAndStdout(): mixed
|
|
||||||
{
|
|
||||||
return $this->redirect_stdin_and_stdout;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return int
|
|
||||||
*/
|
|
||||||
public function getPipeType(): int
|
|
||||||
{
|
|
||||||
return $this->pipe_type;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return bool
|
|
||||||
*/
|
|
||||||
public function isEnableCoroutine(): bool
|
|
||||||
{
|
|
||||||
return $this->enable_coroutine;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @return string
|
|
||||||
*/
|
|
||||||
public function getName(): string
|
|
||||||
{
|
|
||||||
return $this->name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* @param \Swoole\Process $process
|
|
||||||
*/
|
|
||||||
public function start(\Swoole\Process $process)
|
|
||||||
{
|
|
||||||
$this->process = $process;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@@ -1,52 +0,0 @@
|
|||||||
<?php
|
|
||||||
|
|
||||||
namespace Kiri\Process;
|
|
||||||
|
|
||||||
require_once 'OnProcessInterface.php';
|
|
||||||
require_once 'Process.php';
|
|
||||||
|
|
||||||
use function Co\run;
|
|
||||||
|
|
||||||
class TestProcess extends Process
|
|
||||||
{
|
|
||||||
|
|
||||||
|
|
||||||
protected string $name = 'test process';
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*/
|
|
||||||
public function onStart()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function handle()
|
|
||||||
{
|
|
||||||
// TODO: Implement doWhile() method.
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public function onShutdown()
|
|
||||||
{
|
|
||||||
// TODO: Implement onShutdown() method.
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$array = [];
|
|
||||||
|
|
||||||
for ($i = 0; $i < 10; $i++) {
|
|
||||||
$class = new TestProcess();
|
|
||||||
$process = new \Swoole\Process([$class, 'start'], $class->getRedirectStdinAndStdout(),
|
|
||||||
$class->getPipeType(), $class->isEnableCoroutine());
|
|
||||||
$process->start();
|
|
||||||
|
|
||||||
array_push($array, $process);
|
|
||||||
}
|
|
||||||
run(function () use ($array) {
|
|
||||||
|
|
||||||
foreach ($array as $value) {
|
|
||||||
var_dump($value->getCallback());
|
|
||||||
}
|
|
||||||
|
|
||||||
});
|
|
||||||
Reference in New Issue
Block a user