This commit is contained in:
2020-09-15 18:19:37 +08:00
parent 77f38e66d4
commit 37ba025008
+4 -1
View File
@@ -16,6 +16,7 @@ use Exception;
use Snowflake\Core\Help; use Snowflake\Core\Help;
use Snowflake\Exception\ComponentException; use Snowflake\Exception\ComponentException;
use Snowflake\Snowflake; use Snowflake\Snowflake;
use Swoole\Coroutine;
use Swoole\Http\Response as SResponse; use Swoole\Http\Response as SResponse;
/** /**
@@ -116,6 +117,9 @@ class Response extends Application
if ($response instanceof SResponse) { if ($response instanceof SResponse) {
$this->response = $response; $this->response = $response;
} }
Coroutine::defer(function () {
unset($this->response);
});
if ($this->response instanceof SResponse) { if ($this->response instanceof SResponse) {
return $this->sendData($this->response, $sendData, $statusCode); return $this->sendData($this->response, $sendData, $statusCode);
} else { } else {
@@ -175,7 +179,6 @@ class Response extends Application
$response->header('Access-Control-Allow-Origin', '*'); $response->header('Access-Control-Allow-Origin', '*');
$response->header('Run-Time', $this->getRuntime()); $response->header('Run-Time', $this->getRuntime());
$response->end($sendData); $response->end($sendData);
unset($response);
return $sendData; return $sendData;
} }