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\Artwork;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUniqueUntilProcessing;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
@@ -21,16 +22,29 @@ use Meilisearch\Client as MeilisearchClient;
|
||||
* after_commit double-dispatch problem and ensures the document lands
|
||||
* in the index within this job's execution, with no extra queue hop.
|
||||
*/
|
||||
class IndexArtworkJob implements ShouldQueue
|
||||
class IndexArtworkJob implements ShouldQueue, ShouldBeUniqueUntilProcessing
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public int $tries = 3;
|
||||
public int $timeout = 60;
|
||||
|
||||
/**
|
||||
* Unique while queued so Meilisearch isn't flooded. handle() loads the
|
||||
* artwork from DB, so a dropped duplicate still indexes current state.
|
||||
* UniqueUntilProcessing: a change after the worker starts can enqueue again.
|
||||
*/
|
||||
public int $uniqueFor = 120;
|
||||
|
||||
public function __construct(public readonly int $artworkId)
|
||||
{
|
||||
$this->afterCommit = true;
|
||||
$this->onQueue((string) config('scout.queue.queue', 'search'));
|
||||
}
|
||||
|
||||
public function uniqueId(): string
|
||||
{
|
||||
return (string) $this->artworkId;
|
||||
}
|
||||
|
||||
public function handle(MeilisearchClient $client): void
|
||||
|
||||
Reference in New Issue
Block a user