gg
Deploy Iddaai Backend / build-and-deploy (push) Failing after 2m15s

This commit is contained in:
2026-05-11 20:50:31 +03:00
parent 70fdc066c7
commit 4dcc4ced50
8 changed files with 718 additions and 192 deletions
@@ -6,6 +6,7 @@
*/
import { Injectable, Logger } from "@nestjs/common";
import { Prisma } from "@prisma/client";
import { PrismaService } from "../../database/prisma.service";
import {
Sport,
@@ -858,11 +859,11 @@ export class FeederPersistenceService {
// Use raw SQL for performance — Prisma's { some: {} } relation filters
// generate heavy correlated subqueries that hang on Raspberry Pi with
// large tables (15M+ odd_selections, 3M+ participations).
const result = await this.prisma.$queryRawUnsafe<Array<{ id: string }>>(
`
const result = await this.prisma.$queryRaw<Array<{ id: string }>>(
Prisma.sql`
SELECT m.id
FROM matches m
WHERE m.id = ANY($1::text[])
WHERE m.id = ANY(${matchIds}::text[])
AND EXISTS (SELECT 1 FROM odd_categories oc WHERE oc.match_id = m.id)
AND (
(m.sport = 'football'
@@ -875,7 +876,6 @@ export class FeederPersistenceService {
AND EXISTS (SELECT 1 FROM basketball_player_stats bps WHERE bps.match_id = m.id))
)
`,
matchIds,
);
return result.map((r) => r.id);