Skip to content

Commit 2f3a4dc

Browse files
committed
update: laravelS v3.4 Fix: guards 被缓存在单例的问题
1 parent e05bd16 commit 2f3a4dc

File tree

2 files changed

+13
-11
lines changed

2 files changed

+13
-11
lines changed

laravel/bin/fswatch

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,11 @@ echo "Restarting LaravelS..."
99

1010
echo "Starting fswatch..."
1111
LOCKING=0
12-
fswatch -e ".*" -i "\\.php$" ${WORK_DIR} | while read file
12+
fswatch -e ".*" -i "\\.php$" -m poll_monitor -r ${WORK_DIR} | while read file
1313
do
14+
if [[ ! ${file} =~ .php$ ]] ;then
15+
continue
16+
fi
1417
if [ ${LOCKING} -eq 1 ] ;then
1518
echo "Reloading, skipped."
1619
continue

laravel/config/laravels.php

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
return [
77
'listen_ip' => env('LARAVELS_LISTEN_IP', '0.0.0.0'),
88
'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,
1010
'enable_coroutine_runtime' => false,
1111
'server' => env('LARAVELS_SERVER', 'LaravelS'),
1212
'handle_static' => env('LARAVELS_HANDLE_STATIC', false),
@@ -18,8 +18,7 @@
1818
'excluded_dirs' => [],
1919
'log' => true,
2020
],
21-
'event_handlers' => [
22-
],
21+
'event_handlers' => [],
2322
'websocket' => [
2423
'enable' => true, // 看清楚,这里是true
2524
'handler' => \App\Services\WebSocketService::class,
@@ -42,6 +41,7 @@
4241
// [\App\Jobs\XxxCronJob::class, [1000, true]], // Pass in parameters when registering
4342
// \App\Jobs\XxxCronJob::class, // Override the corresponding method to return the configuration
4443
],
44+
'pid_file' => storage_path('laravels-timer.pid'),
4545
'max_wait_time' => 5, // Reload 时最大等待时间
4646
],
4747
// 绑定事件与监听器,一个事件可以有多个监听器,多个监听器按顺序执行
@@ -59,21 +59,20 @@
5959
//Hhxsv5\LaravelS\Illuminate\Cleaners\SessionCleaner::class, // 如果你的项目中使用到了Session或Authentication,请解除这行注释
6060
//Hhxsv5\LaravelS\Illuminate\Cleaners\AuthCleaner::class, // 如果你的项目中使用到了Authentication或Passport,请解除这行注释
6161
Hhxsv5\LaravelS\Illuminate\Cleaners\JWTCleaner::class, // 如果你的项目中使用到了包"tymon/jwt-auth",请解除这行注释
62+
Hhxsv5\LaravelS\Illuminate\Cleaners\RequestCleaner::class,
6263
//...
6364
],
64-
'register_providers' => [
65-
],
6665
'swoole' => [
6766
'daemonize' => env('LARAVELS_DAEMONIZE', false),
6867
// dispatch_mode 只能设置为 2、4、5,https://wiki.swoole.com/wiki/page/277.html
6968
'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,
7372
'task_ipc_mode' => 1,
74-
'task_max_request' => 5000,
73+
'task_max_request' => 8000,
7574
'task_tmpdir' => @is_writable('/dev/shm/') ? '/dev/shm' : '/tmp',
76-
'max_request' => 3000,
75+
'max_request' => 8000,
7776
'open_tcp_nodelay' => true,
7877
'pid_file' => storage_path('laravels.pid'),
7978
'log_file' => storage_path(sprintf('logs/swoole-%s.log', date('Y-m'))),

0 commit comments

Comments
 (0)