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\Services\RankingService;
|
||||
use Illuminate\Bus\Queueable;
|
||||
use Illuminate\Contracts\Queue\ShouldBeUnique;
|
||||
use Illuminate\Contracts\Queue\ShouldQueue;
|
||||
use Illuminate\Foundation\Bus\Dispatchable;
|
||||
use Illuminate\Queue\InteractsWithQueue;
|
||||
@@ -13,19 +14,32 @@ use Illuminate\Queue\SerializesModels;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Log;
|
||||
|
||||
class RankBuildScopeListsJob implements ShouldQueue
|
||||
class RankBuildScopeListsJob implements ShouldQueue, ShouldBeUnique
|
||||
{
|
||||
use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;
|
||||
|
||||
public int $timeout = 300;
|
||||
public int $tries = 2;
|
||||
|
||||
/**
|
||||
* Unique until the job finishes or uniqueFor elapses.
|
||||
* Must outlast the queue wait (hours) plus timeout (300s), not just 360s.
|
||||
*/
|
||||
public int $uniqueFor;
|
||||
|
||||
private const LIST_TYPES = ['trending', 'new_hot', 'best'];
|
||||
|
||||
public function __construct(
|
||||
public readonly string $scopeType,
|
||||
public readonly int $scopeId,
|
||||
) {}
|
||||
) {
|
||||
$this->uniqueFor = max(3600, (int) config('ranking.scope_job_unique_for', 21600));
|
||||
}
|
||||
|
||||
public function uniqueId(): string
|
||||
{
|
||||
return $this->scopeType . ':' . $this->scopeId;
|
||||
}
|
||||
|
||||
public function handle(RankingService $ranking): void
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user