优化定时任务调度耗时

This commit is contained in:
pllx
2026-05-04 18:18:35 +08:00
parent b3eebd286e
commit 6225a0fb45
4 changed files with 324 additions and 48 deletions
+2 -2
View File
@@ -12,14 +12,14 @@ Artisan::command('inspire', function () {
Schedule::command('messages:purge')->dailyAt('03:00');
// 每 5 分钟为所有在线用户自动存点(经验/金币/等级)
Schedule::command('chatroom:auto-save-exp')->everyFiveMinutes();
Schedule::command('chatroom:auto-save-exp')->everyFiveMinutes()->withoutOverlapping()->runInBackground();
// 每 10 分钟扫描最近活跃用户的成就进度,夜间再做一次全量补算
Schedule::command('achievements:scan --notify')->everyTenMinutes()->withoutOverlapping();
Schedule::command('achievements:scan --all')->dailyAt('03:30')->withoutOverlapping();
// 每 1 分钟为 AI小班长 独立模拟一次挂机心跳,触发随机事件
Schedule::command('chatroom:ai-heartbeat')->everyMinute();
Schedule::command('chatroom:ai-heartbeat')->everyMinute()->withoutOverlapping()->runInBackground();
// 每 15 分钟:关闭掉线用户的开放职务日志(久无心跳 = 掉线,自动写入 logout_at
Schedule::command('duty:close-stale-logs')->everyFifteenMinutes();