Вырезал из кода ненужный asserBatchSize.

This commit is contained in:
Первов Артем
2026-06-21 02:24:02 +03:00
parent 8819adf42b
commit 919268c987
4 changed files with 1 additions and 18 deletions

View File

@@ -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.`);
}
}
}