fix: bound formatter memory and improve operations workflows
This commit is contained in:
@@ -1,24 +1,9 @@
|
||||
import {
|
||||
BadRequestException,
|
||||
Injectable,
|
||||
Logger,
|
||||
NotFoundException,
|
||||
OnModuleDestroy,
|
||||
OnModuleInit,
|
||||
} from '@nestjs/common';
|
||||
import { Queue } from 'bullmq';
|
||||
import IORedis from 'ioredis';
|
||||
import { BadRequestException, NotFoundException } from '@nestjs/common';
|
||||
|
||||
import { Prisma } from '@prisma/client';
|
||||
import { randomUUID } from 'crypto';
|
||||
import { assertMoneyUnits, moneyToNumber } from '../common/money';
|
||||
|
||||
import { PrismaService } from '../prisma/prisma.service';
|
||||
import type {
|
||||
CreateChannelDto,
|
||||
UpdateChannelDto,
|
||||
CreateChannelGroupDto,
|
||||
CreateChannelGroupItemDto,
|
||||
UpdateChannelGroupDto,
|
||||
CreateRouteRuleDto,
|
||||
CreateReportFieldDto,
|
||||
ReplaceReportFieldsDto,
|
||||
CreateReportMaterialDto,
|
||||
@@ -26,73 +11,19 @@ import type {
|
||||
ChangeReportTaskStatusesDto,
|
||||
CreateReportExportDto,
|
||||
CreateReceiptImportDto,
|
||||
UpsertConnectionStateDto,
|
||||
ChangeChannelStatusDto,
|
||||
CopyChannelDto,
|
||||
TestChannelDto,
|
||||
} from './channels.contracts';
|
||||
import {
|
||||
GATEWAY_CONNECTION_QUEUE,
|
||||
GATEWAY_SUBMIT_QUEUE,
|
||||
GATEWAY_SUBMIT_STREAM,
|
||||
DEFAULT_GATEWAY_CONTROL_URL,
|
||||
DEFAULT_CHANNEL_CONNECTION_ID,
|
||||
DEFAULT_CONNECTING_TIMEOUT_MS,
|
||||
DEFAULT_CONNECTING_TIMEOUT_SCAN_MS,
|
||||
DEFAULT_GATEWAY_STARTUP_RECONNECT_DELAY_MS,
|
||||
DEFAULT_GATEWAY_RECONCILE_INTERVAL_MS,
|
||||
DEFAULT_GATEWAY_CONTROL_TIMEOUT_MS,
|
||||
DEFAULT_HEARTBEAT_INTERVAL_SECONDS,
|
||||
DEFAULT_HEARTBEAT_MISS_THRESHOLD,
|
||||
HEARTBEAT_AUDIT_INTERVAL_MS,
|
||||
CONNECTING_TIMEOUT_ERROR,
|
||||
DEFAULT_CMPP_VERSION,
|
||||
normalizeTestPhones,
|
||||
normalizeTestContent,
|
||||
calculateBillingUnits,
|
||||
buildChannelTestSubmitCommand,
|
||||
getConfigValue,
|
||||
getStringConfigValue,
|
||||
normalizeConnectionAction,
|
||||
normalizeCmppVersion,
|
||||
normalizeGatewayConnectionStatus,
|
||||
defaultChannelConnectionId,
|
||||
getDesiredConnections,
|
||||
ChannelConnectionSettings,
|
||||
getRuntimeConfigInteger,
|
||||
channelConnectionSettingsChanged,
|
||||
channelGroupAuditSnapshot,
|
||||
normalizeChannelRuntimeConfig,
|
||||
normalizeCmppServiceId,
|
||||
normalizeChannelRateLimit,
|
||||
normalizeExtensionDigits,
|
||||
getPositiveRuntimeInteger,
|
||||
bullmqConnection,
|
||||
getPositiveIntegerEnv,
|
||||
parseReceiptContent,
|
||||
splitReceiptLine,
|
||||
stripReceiptCell,
|
||||
findReceiptStatusIndex,
|
||||
normalizeReceiptStatus,
|
||||
deriveReceiptStatus,
|
||||
ChannelReportDeliveryRow,
|
||||
summarizeChannelReportDelivery,
|
||||
sumReportDelivery,
|
||||
percentage,
|
||||
latestDate,
|
||||
currentShanghaiDayRange,
|
||||
normalizeRetryTimeLimitMinutes,
|
||||
normalizeSpreadsheetSize,
|
||||
normalizeBusinessCarrier,
|
||||
normalizeChannelCarrier,
|
||||
normalizeChannelCarriers,
|
||||
isChannelCarrierCompatible,
|
||||
normalizeRegion,
|
||||
isRegionCompatible,
|
||||
validateGroupItems,
|
||||
normalizeReportType,
|
||||
summarizeReportStatuses,
|
||||
normalizeLinkEvent,
|
||||
} from './channels.helpers';
|
||||
|
||||
/** R5 channel domain service composed behind ChannelsService. */
|
||||
@@ -155,6 +86,9 @@ export class ChannelReportingService {
|
||||
for (const legacy of legacyBoth) {
|
||||
if (oppositeCodes.has(legacy.code)) continue;
|
||||
const { id: _id, createdAt: _createdAt, updatedAt: _updatedAt, ...legacyData } = legacy;
|
||||
void _id;
|
||||
void _createdAt;
|
||||
void _updatedAt;
|
||||
await tx.channelReportField.create({ data: { ...legacyData, reportType: oppositeType } });
|
||||
}
|
||||
for (const [index, configured] of data.fields.entries()) {
|
||||
@@ -225,7 +159,12 @@ export class ChannelReportingService {
|
||||
const tasks = await this.prisma.channelSignatureReportTask.findMany({
|
||||
where: {
|
||||
tenantId,
|
||||
status,
|
||||
status:
|
||||
status === 'reporting' || status === 'exporting'
|
||||
? { in: ['reporting', 'exporting'] }
|
||||
: status === 'failed'
|
||||
? { in: ['failed', 'rejected'] }
|
||||
: status,
|
||||
channelId,
|
||||
reportType,
|
||||
signature: { auditStatus: { not: 'deleted' } },
|
||||
|
||||
Reference in New Issue
Block a user