Compare commits

...

5 Commits

Author SHA1 Message Date
as2252258 6a5205e9a1 1 2021-11-11 02:22:14 +08:00
as2252258 471f7a92bb 1 2021-11-11 01:32:04 +08:00
as2252258 429ffe561c 改名 2021-11-08 11:12:53 +08:00
as2252258 27cdf5082f 改名 2021-11-08 11:10:58 +08:00
as2252258 4c3751ca4d 1 2021-11-07 03:18:27 +08:00
8 changed files with 17 additions and 160 deletions
+1 -1
View File
@@ -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('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('MODEL_PATH') or define('MODEL_PATH', APP_PATH . 'app/Models/');
defined('MODEL_PATH') or define('MODEL_PATH', APP_PATH . 'app/Model/');
/**
+7
View File
@@ -220,6 +220,13 @@ class Pool extends Component
return;
}
while (static::$_connections[$name]->length() > 0) {
if (static::$_connections[$name] instanceof Channel)
{
if (!Context::inCoroutine())
{
break;
}
}
$client = static::$_connections[$name]->pop();
if ($client instanceof StopHeartbeatCheck) {
$client->stopHeartbeatCheck();
+4 -4
View File
@@ -30,11 +30,11 @@ class Gii
private InputInterface $input;
public string $modelPath = APP_PATH . 'app/Models/';
public string $modelNamespace = 'App\\Models\\';
public string $modelPath = APP_PATH . 'app/Model/';
public string $modelNamespace = 'App\\Model\\';
public string $controllerPath = APP_PATH . 'app/Http/Controllers/';
public string $controllerNamespace = 'App\\Controllers\\';
public string $controllerPath = APP_PATH . 'app/Http/Controller/';
public string $controllerNamespace = 'App\\Controller\\';
public static array $createSqls = [];
+4 -4
View File
@@ -24,11 +24,11 @@ abstract class GiiBase
protected InputInterface $input;
public string $modelPath = APP_PATH . 'app/Models/';
public string $modelNamespace = 'App\Models\\';
public string $modelPath = APP_PATH . 'app/Model/';
public string $modelNamespace = 'App\Model\\';
public string $controllerPath = APP_PATH . 'app/Http/Controllers/';
public string $controllerNamespace = 'App\\Controllers\\';
public string $controllerPath = APP_PATH . 'app/Http/Controller/';
public string $controllerNamespace = 'App\\Controller\\';
public ?string $module = null;
+1 -1
View File
@@ -92,7 +92,7 @@ use Kiri\Core\Json;
use Database\Connection;
use Database\Annotation\Get;
use Database\Annotation\Set;
use Annotation\Model\Relation;
use Database\Relation;
use Database\Model;
' . PHP_EOL;
}
-10
View File
@@ -1,10 +0,0 @@
<?php
namespace Kiri\Process;
interface OnProcessInterface
{
public function handle();
}
-88
View File
@@ -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;
}
}
-52
View File
@@ -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());
}
});