This commit is contained in:
2020-09-07 15:54:53 +08:00
parent c71376e6e4
commit 6493fc9450
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -15,6 +15,7 @@ use Snowflake\Event;
use Snowflake\Exception\ComponentException;
use Snowflake\Exception\ConfigException;
use Snowflake\Snowflake;
use Swoole\Coroutine;
use Swoole\Server;
use Closure;
@@ -32,7 +33,7 @@ class OnShutdown extends Callback
*/
public function onHandler(Server $server)
{
$this->system_mail('server shutdown~');
Coroutine::create([$this,'system_mail'],'server shutdown~');
$event = Snowflake::app()->getEvent();
if (!$event->exists(Event::SERVER_SHUTDOWN)) {
return;
+2 -1
View File
@@ -8,6 +8,7 @@ use Exception;
use HttpServer\Abstracts\Callback;
use Snowflake\Abstracts\Config;
use Snowflake\Exception\ConfigException;
use Swoole\Coroutine;
use Swoole\Server;
class OnWorkerError extends Callback
@@ -27,7 +28,7 @@ class OnWorkerError extends Callback
if (!Config::has('email')) {
return;
}
$this->system_mail(print_r([
Coroutine::create([$this,'system_mail'],print_r([
'$worker_pid' => $worker_pid,
'$worker_id' => $worker_id,
'$exit_code' => $exit_code,