Skip to content

Commit

Permalink
Fix Health ScheduleCheck (#999)
Browse files Browse the repository at this point in the history
* Use `ScheduleCheck` instead of a blank `Check`
  • Loading branch information
RMartinOscar authored Feb 11, 2025
1 parent 35d25d2 commit 8f47ccf
Showing 1 changed file with 2 additions and 39 deletions.
41 changes: 2 additions & 39 deletions app/Checks/ScheduleCheck.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,48 +4,11 @@

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'));
Expand Down

0 comments on commit 8f47ccf

Please sign in to comment.