Laravel 13 + Filament 5 admin panel and REST API for a non-profit developer collective, backed by the Pireon OAuth identity server. The public site is a separate, server-rendered application consuming /api/public/v1. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
45 lines
1.0 KiB
PHP
45 lines
1.0 KiB
PHP
<?php
|
|
|
|
declare(strict_types=1);
|
|
|
|
namespace App\Support\Health\Checks;
|
|
|
|
use App\Models\Media;
|
|
use App\Support\Health\Check;
|
|
use App\Support\Health\Finding;
|
|
|
|
/**
|
|
* Images that have been waiting to be processed for too long.
|
|
*
|
|
* Uploads queue their own work and the scheduler sweeps up every ten minutes,
|
|
* so anything still pending an hour later means neither is running. The site
|
|
* keeps working — images serve without dimensions or `srcset` — which is
|
|
* precisely why nobody would notice.
|
|
*/
|
|
class StalledMediaQueue implements Check
|
|
{
|
|
public function key(): string
|
|
{
|
|
return 'stalled-media';
|
|
}
|
|
|
|
public function permission(): ?string
|
|
{
|
|
return null;
|
|
}
|
|
|
|
public function run(): Finding
|
|
{
|
|
$stalled = Media::query()
|
|
->pending()
|
|
->where('created_at', '<', now()->subHour())
|
|
->get(['id', 'path']);
|
|
|
|
return Finding::problem(
|
|
$this->key(),
|
|
$stalled->count(),
|
|
samples: $stalled->pluck('path')->all(),
|
|
);
|
|
}
|
|
}
|