optimizations
This commit is contained in:
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user