|
6 | 6 | return [
|
7 | 7 | 'listen_ip' => env('LARAVELS_LISTEN_IP', '0.0.0.0'),
|
8 | 8 | 'listen_port' => env('LARAVELS_LISTEN_PORT', 5200),
|
9 |
| - 'socket_type' => defined('SWOOLE_SOCK_TCP') ? \SWOOLE_SOCK_TCP : 1, |
| 9 | + 'socket_type' => defined('SWOOLE_SOCK_TCP') ? SWOOLE_SOCK_TCP : 1, |
10 | 10 | 'enable_coroutine_runtime' => false,
|
11 | 11 | 'server' => env('LARAVELS_SERVER', 'LaravelS'),
|
12 | 12 | 'handle_static' => env('LARAVELS_HANDLE_STATIC', false),
|
|
18 | 18 | 'excluded_dirs' => [],
|
19 | 19 | 'log' => true,
|
20 | 20 | ],
|
21 |
| - 'event_handlers' => [ |
22 |
| - ], |
| 21 | + 'event_handlers' => [], |
23 | 22 | 'websocket' => [
|
24 | 23 | 'enable' => true, // 看清楚,这里是true
|
25 | 24 | 'handler' => \App\Services\WebSocketService::class,
|
|
42 | 41 | // [\App\Jobs\XxxCronJob::class, [1000, true]], // Pass in parameters when registering
|
43 | 42 | // \App\Jobs\XxxCronJob::class, // Override the corresponding method to return the configuration
|
44 | 43 | ],
|
| 44 | + 'pid_file' => storage_path('laravels-timer.pid'), |
45 | 45 | 'max_wait_time' => 5, // Reload 时最大等待时间
|
46 | 46 | ],
|
47 | 47 | // 绑定事件与监听器,一个事件可以有多个监听器,多个监听器按顺序执行
|
|
59 | 59 | //Hhxsv5\LaravelS\Illuminate\Cleaners\SessionCleaner::class, // 如果你的项目中使用到了Session或Authentication,请解除这行注释
|
60 | 60 | //Hhxsv5\LaravelS\Illuminate\Cleaners\AuthCleaner::class, // 如果你的项目中使用到了Authentication或Passport,请解除这行注释
|
61 | 61 | Hhxsv5\LaravelS\Illuminate\Cleaners\JWTCleaner::class, // 如果你的项目中使用到了包"tymon/jwt-auth",请解除这行注释
|
| 62 | + Hhxsv5\LaravelS\Illuminate\Cleaners\RequestCleaner::class, |
62 | 63 | //...
|
63 | 64 | ],
|
64 |
| - 'register_providers' => [ |
65 |
| - ], |
66 | 65 | 'swoole' => [
|
67 | 66 | 'daemonize' => env('LARAVELS_DAEMONIZE', false),
|
68 | 67 | // dispatch_mode 只能设置为 2、4、5,https://wiki.swoole.com/wiki/page/277.html
|
69 | 68 | 'dispatch_mode' => 2,
|
70 |
| - 'reactor_num' => function_exists('\swoole_cpu_num') ? \swoole_cpu_num() * 2 : 4, |
71 |
| - 'worker_num' => function_exists('\swoole_cpu_num') ? \swoole_cpu_num() * 2 : 8, |
72 |
| - 'task_worker_num' => function_exists('\swoole_cpu_num') ? \swoole_cpu_num() * 2 : 8, |
| 69 | + 'reactor_num' => function_exists('swoole_cpu_num') ? swoole_cpu_num() * 2 : 4, |
| 70 | + 'worker_num' => function_exists('swoole_cpu_num') ? swoole_cpu_num() * 2 : 8, |
| 71 | + 'task_worker_num' => function_exists('swoole_cpu_num') ? swoole_cpu_num() * 2 : 8, |
73 | 72 | 'task_ipc_mode' => 1,
|
74 |
| - 'task_max_request' => 5000, |
| 73 | + 'task_max_request' => 8000, |
75 | 74 | 'task_tmpdir' => @is_writable('/dev/shm/') ? '/dev/shm' : '/tmp',
|
76 |
| - 'max_request' => 3000, |
| 75 | + 'max_request' => 8000, |
77 | 76 | 'open_tcp_nodelay' => true,
|
78 | 77 | 'pid_file' => storage_path('laravels.pid'),
|
79 | 78 | 'log_file' => storage_path(sprintf('logs/swoole-%s.log', date('Y-m'))),
|
|
0 commit comments