cron indicator improvement

This commit is contained in:
Čarodej
2022-03-16 09:50:49 +01:00
parent 9d955799d3
commit 60407f9dce
5 changed files with 7 additions and 7 deletions
+2 -2
View File
@@ -70,8 +70,8 @@ class Kernel extends ConsoleKernel
->daily()
->at('00:20');
// Store latest cron timestamp
cache()->set('latest_cron_update', now()->toString());
$schedule->call(fn () => cache()->set('latest_cron_update', now()->toString()))
->everyMinute();
}
/**
@@ -29,7 +29,7 @@ class GetServerStatusController
// Add cron info
$status['cron'] = [
'running' => isRunningCron(),
'lastUpdate' => isRunningCron() ? format_date(cache()->get('latest_cron_update')) : '',
'lastUpdate' => isRunningCron() ? format_date(cache()->get('latest_cron_update')) : null,
];
return $status;
+1 -1
View File
@@ -44,7 +44,7 @@ if (! function_exists('isRunningCron')) {
*/
function isRunningCron(): bool
{
return cache()->has('latest_cron_update') && Carbon::parse(cache()->get('latest_cron_update'))->diffInMinutes(now()) < 2;
return cache()->has('latest_cron_update') && Carbon::parse(cache()->get('latest_cron_update'))->diffInMinutes(now()) <= 1;
}
}