From 919268c9874160dcbd3253371483e87386f01d46 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9F=D0=B5=D1=80=D0=B2=D0=BE=D0=B2=20=D0=90=D1=80=D1=82?= =?UTF-8?q?=D0=B5=D0=BC?= Date: Sun, 21 Jun 2026 02:24:02 +0300 Subject: [PATCH] =?UTF-8?q?=D0=92=D1=8B=D1=80=D0=B5=D0=B7=D0=B0=D0=BB=20?= =?UTF-8?q?=D0=B8=D0=B7=20=D0=BA=D0=BE=D0=B4=D0=B0=20=D0=BD=D0=B5=D0=BD?= =?UTF-8?q?=D1=83=D0=B6=D0=BD=D1=8B=D0=B9=20asserBatchSize.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .env.example | 3 --- .env.local.example | 1 - docker-compose.yml | 1 - src/ingest/ingest.service.ts | 14 +------------- 4 files changed, 1 insertion(+), 18 deletions(-) diff --git a/.env.example b/.env.example index 2f89709..ec18ece 100644 --- a/.env.example +++ b/.env.example @@ -8,8 +8,5 @@ INGEST_API_KEY= # Pool sizing for node-postgres. PG_POOL_MAX=20 -# Maximum points accepted by one POST /ingest request. -INGEST_MAX_BATCH_SIZE=10000 - # Poll interval for GET /current/events SSE snapshots. CURRENT_EVENTS_POLL_MS=1000 diff --git a/.env.local.example b/.env.local.example index 064a209..05a909f 100644 --- a/.env.local.example +++ b/.env.local.example @@ -3,5 +3,4 @@ DATABASE_URL=postgres://greact:pG3526l4@194.36.208.86:5433/cloud CORS_ALLOWED_ORIGINS=http://localhost:3000,http://localhost:5173 INGEST_API_KEY= PG_POOL_MAX=20 -INGEST_MAX_BATCH_SIZE=10000 CURRENT_EVENTS_POLL_MS=1000 diff --git a/docker-compose.yml b/docker-compose.yml index e0aae92..d9b4c61 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -10,7 +10,6 @@ services: CORS_ALLOWED_ORIGINS: ${CORS_ALLOWED_ORIGINS} INGEST_API_KEY: ${INGEST_API_KEY} PG_POOL_MAX: ${PG_POOL_MAX} - INGEST_MAX_BATCH_SIZE: ${INGEST_MAX_BATCH_SIZE} CURRENT_EVENTS_POLL_MS: ${CURRENT_EVENTS_POLL_MS} ports: - "${PORT}:${PORT}" diff --git a/src/ingest/ingest.service.ts b/src/ingest/ingest.service.ts index 19c2494..aa7a126 100644 --- a/src/ingest/ingest.service.ts +++ b/src/ingest/ingest.service.ts @@ -1,4 +1,4 @@ -import { BadRequestException, Injectable } from '@nestjs/common'; +import { Injectable } from '@nestjs/common'; import { DbService } from '../db/db.service'; import { IngestPointDto } from './dto/ingest-point.dto'; @@ -23,8 +23,6 @@ export class IngestService { return { processed: 0 }; } - this.assertBatchSize(points.length); - const normalized: NormalizedPoint[] = points.map((point) => ({ edge: point.edge, tag: point.tag, @@ -83,14 +81,4 @@ export class IngestService { return { processed: normalized.length }; } - - /** Защищает API от слишком больших ingest-запросов, занимающих соединение с БД надолго. */ - private assertBatchSize(size: number): void { - const maxBatchSize = Number(process.env.INGEST_MAX_BATCH_SIZE); - - if (size > maxBatchSize) { - throw new BadRequestException(`Batch size must not exceed ${maxBatchSize} points.`); - } - } - }