This commit is contained in:
2021-03-23 10:41:18 +08:00
parent c394f4990b
commit 7a8c5cf6bc
2 changed files with 507 additions and 502 deletions
+1 -1
View File
@@ -247,7 +247,7 @@ class Server extends HttpService
if (!is_string($process)) {
continue;
}
$system = new $process(Snowflake::app(), $name, true);
$system = Snowflake::createObject($process, [Snowflake::app(), $name, true]);
if (isset($this->params[$name])) {
$system->write(Json::encode($this->params[$name]));
}
+9 -4
View File
@@ -5,9 +5,12 @@ namespace Snowflake\Process;
use Exception;
use ReflectionException;
use Snowflake\Crontab;
use Snowflake\Abstracts\Crontab as ACrontab;
use Snowflake\Event;
use Snowflake\Exception\ComponentException;
use Snowflake\Exception\NotFindClassException;
use Snowflake\Snowflake;
use Swoole\Coroutine;
use Swoole\Coroutine\WaitGroup;
@@ -36,6 +39,9 @@ class CrontabProcess extends Process
/**
* @param \Swoole\Process $process
* @throws ReflectionException
* @throws ComponentException
* @throws NotFindClassException
*/
public function onHandler(\Swoole\Process $process): void
{
@@ -66,8 +72,7 @@ class CrontabProcess extends Process
/**
* @param Crontab $value
* @param int $startTime
* @throws \Exception
* @throws Exception
*/
private function dispatch(Crontab $value)
{
@@ -100,8 +105,8 @@ class CrontabProcess extends Process
/**
* @param Crontab $content
* @param $ticker
* @param Crontab $crontab
* @throws Exception
*/
private function addTask(Crontab $crontab)
{