Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix Health ScheduleCheck #999

Merged
merged 2 commits into from
Feb 11, 2025
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 1 addition & 38 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 Check;
use Spatie\Health\Checks\Result;

class ScheduleCheck extends Check
RMartinOscar marked this conversation as resolved.
Show resolved Hide resolved
{
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