Skip to content

Commit 69ae18b

Browse files
authored
use built-in Swoole constants (#57)
1 parent fa4c6a4 commit 69ae18b

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

config/autoload/server.php

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
*/
1212
use Hyperf\Server\Server;
1313
use Hyperf\Server\Event;
14+
use Swoole\Constant;
1415

1516
return [
1617
'mode' => SWOOLE_PROCESS,
@@ -27,15 +28,15 @@
2728
],
2829
],
2930
'settings' => [
30-
'enable_coroutine' => true,
31-
'worker_num' => swoole_cpu_num(),
32-
'pid_file' => BASE_PATH . '/runtime/hyperf.pid',
33-
'open_tcp_nodelay' => true,
34-
'max_coroutine' => 100000,
35-
'open_http2_protocol' => true,
36-
'max_request' => 100000,
37-
'socket_buffer_size' => 2 * 1024 * 1024,
38-
'buffer_output_size' => 2 * 1024 * 1024,
31+
Constant::OPTION_ENABLE_COROUTINE => true,
32+
Constant::OPTION_WORKER_NUM => swoole_cpu_num(),
33+
Constant::OPTION_PID_FILE => BASE_PATH . '/runtime/hyperf.pid',
34+
Constant::OPTION_OPEN_TCP_NODELAY => true,
35+
Constant::OPTION_MAX_COROUTINE => 100000,
36+
Constant::OPTION_OPEN_HTTP2_PROTOCOL => true,
37+
Constant::OPTION_MAX_REQUEST => 100000,
38+
Constant::OPTION_SOCKET_BUFFER_SIZE => 2 * 1024 * 1024,
39+
Constant::OPTION_BUFFER_OUTPUT_SIZE => 2 * 1024 * 1024,
3940
],
4041
'callbacks' => [
4142
Event::ON_WORKER_START => [Hyperf\Framework\Bootstrap\WorkerStartCallback::class, 'onWorkerStart'],

0 commit comments

Comments
 (0)