Ship production optimization M1-M12.5A: queues, metrics, HTTP observability, and vector search reliability.
Keep similar-ai from tripping the global circuit on a lone URL 502, clamp Qdrant search to 100, and add Server-Timing plus slow-request logging. Studio shared props, Academy S3 exists caching, heat chunking, and Redis/scheduler hygiene stay in this rollout.
This commit is contained in:
@@ -6,6 +6,7 @@ namespace App\Jobs;
|
||||
|
||||
use App\Models\User;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
@@ -15,14 +16,28 @@ use Illuminate\Queue\SerializesModels;
|
||||
* Queued job: index (or re-index) a single User in Meilisearch.
|
||||
* Dispatched by UserStatsService whenever stats change.
|
||||
*/
|
||||
class IndexUserJob implements ShouldQueue
|
||||
class IndexUserJob implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public int $tries = 3;
|
||||
public int $timeout = 30;
|
||||
|
||||
public function __construct(public readonly int $userId) {}
|
||||
/**
|
||||
* Unique while queued. handle() loads the user from DB so the queued job
|
||||
* still reflects later stats changes. uniqueFor covers a dead worker lock.
|
||||
*/
|
||||
public int $uniqueFor = 60;
|
||||
|
||||
public function __construct(public readonly int $userId)
|
||||
{
|
||||
$this->onQueue((string) config('scout.queue.queue', 'search'));
|
||||
}
|
||||
|
||||
public function uniqueId(): string
|
||||
{
|
||||
return (string) $this->userId;
|
||||
}
|
||||
|
||||
public function handle(): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user