optimizations

This commit is contained in:
2026-03-28 19:15:39 +01:00
parent 0b25d9570a
commit cab4fbd83e
509 changed files with 1016804 additions and 1605 deletions

View File

@@ -5,6 +5,7 @@ declare(strict_types=1);
namespace App\Jobs;
use App\Services\Recommendations\UserInterestProfileService;
use App\Services\Recommendations\SessionRecoService;
use Carbon\CarbonImmutable;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
@@ -42,7 +43,7 @@ final class IngestUserDiscoveryEventJob implements ShouldQueue
) {
}
public function handle(UserInterestProfileService $profileService): void
public function handle(UserInterestProfileService $profileService, SessionRecoService $sessionRecoService): void
{
$idempotencyKey = sprintf('discovery:event:processed:%s', $this->eventId);
@@ -107,6 +108,15 @@ final class IngestUserDiscoveryEventJob implements ShouldQueue
algoVersion: $this->algoVersion,
eventMeta: $this->meta
);
$sessionRecoService->applyEvent(
userId: $this->userId,
eventType: $this->eventType,
artworkId: $this->artworkId,
categoryId: $categoryId !== null ? (int) $categoryId : null,
occurredAt: $occurredAt->toIso8601String(),
meta: $this->meta,
);
} catch (\Throwable $e) {
Log::error('IngestUserDiscoveryEventJob failed', [
'event_id' => $this->eventId,