Fix Health ScheduleCheck (#999)

* Use `ScheduleCheck` instead of a blank `Check`
This commit is contained in:
MartinOscar 2025-02-11 22:11:07 +01:00 committed by GitHub
parent 35d25d216e
commit 8f47ccfbf7
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -4,48 +4,11 @@ namespace App\Checks;
use Carbon\Carbon;
use Composer\InstalledVersions;
use Spatie\Health\Checks\Check;
use Spatie\Health\Checks\Checks\ScheduleCheck as BaseCheck;
use Spatie\Health\Checks\Result;
class ScheduleCheck extends Check
class ScheduleCheck extends BaseCheck
{
protected string $cacheKey = 'health:checks:schedule:latestHeartbeatAt';
protected ?string $cacheStoreName = null;
protected int $heartbeatMaxAgeInMinutes = 1;
public function useCacheStore(string $cacheStoreName): self
{
$this->cacheStoreName = $cacheStoreName;
return $this;
}
public function getCacheStoreName(): string
{
return $this->cacheStoreName ?? config('cache.default');
}
public function cacheKey(string $cacheKey): self
{
$this->cacheKey = $cacheKey;
return $this;
}
public function heartbeatMaxAgeInMinutes(int $heartbeatMaxAgeInMinutes): self
{
$this->heartbeatMaxAgeInMinutes = $heartbeatMaxAgeInMinutes;
return $this;
}
public function getCacheKey(): string
{
return $this->cacheKey;
}
public function run(): Result
{
$result = Result::make()->ok(trans('admin/health.results.schedule.ok'));