mirror of
https://github.com/crmeb/CRMEB.git
synced 2026-10-29 14:01:07 +00:00
【程序目录】优化定时任务
This commit is contained in:
parent
71ba6730b8
commit
4e26c419fc
@ -245,6 +245,11 @@ class SystemCrontabServices extends BaseServices
|
||||
$crontabRunServices = app()->make(CrontabRunServices::class);
|
||||
// 创建一个每秒钟执行一次的定时任务
|
||||
new Crontab('*/1 * * * * *', function () use ($task, $crontabRunServices) {
|
||||
// 写入时间戳,用于检测定时任务是否正常执行
|
||||
$timerTime = file_get_contents(root_path() . 'runtime/.timer');
|
||||
if ($timerTime < (time() - 60)) {
|
||||
file_put_contents(root_path() . 'runtime/.timer', time());
|
||||
}
|
||||
// 从缓存中获取定时任务列表
|
||||
$list = Cache::get('crontabCache');
|
||||
if (!$list) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user