style(api): apply prettier formatting

This commit is contained in:
dahyeon committed 2026-07-24 21:42:28 -07:00
1 parent 80fef25af3
commit 96fede9fe5
75 files changed
+955 -674

No files matched your search

@@ -19,7 +19,9 @@ describe('auction Redis schema foundation', () => {
expect(AuctionSchema.path('revision')).toBeDefined();
expect(AuctionSchema.path('auctionEngineVersion')).toBeDefined();
expect(AuctionSchema.path('auctionLifecycleId')).toBeDefined();
expect(AuctionSchema.path('lastAppliedAuctionStateTransitionId')).toBeDefined();
expect(
AuctionSchema.path('lastAppliedAuctionStateTransitionId'),
).toBeDefined();
expect(AuctionSchema.path('currentAuctionHistorySequence')).toBeDefined();
expect(AuctionSchema.path('startAuctionRequestId')).toBeDefined();
expect(AuctionSchema.path('startAuctionStateTransitionId')).toBeDefined();
@@ -36,46 +38,75 @@ describe('auction Redis schema foundation', () => {
expect(AuctionSchema.path('auctionBidHistory')).toBeDefined();
expect(AuctionSchema.path('currentHighestBidPointAmount')).toBeDefined();
expect(AuctionSchema.path('currentHighestBidderTeamIndex')).toBeDefined();
expect(AuctionSchema.path('currentBidRoundDeadlineTimestampMS')).toBeDefined();
expect(
AuctionSchema.path('currentBidRoundDeadlineTimestampMS'),
).toBeDefined();
expect(AuctionSchema.path('maximumBidRoundDurationSeconds')).toBeDefined();
expect(AuctionSchema.path('bidRoundExtensionSeconds')).toBeDefined();
expect(AuctionSchema.path('initialTeamBidPointAmount')).toBeDefined();
expect(AuctionSchema.path('topTierAuctionPriorityThreshold')).toBeDefined();
expect(AuctionSchema.path('manualTopTierAuctionPriorityUserIds')).toBeDefined();
expect(
AuctionSchema.path('manualTopTierAuctionPriorityUserIds'),
).toBeDefined();
expect(AuctionSchema.path('auctionStartedAtTimestampMS')).toBeDefined();
expect(AuctionSchema.path('auctionCompletedAtTimestampMS')).toBeDefined();
});
it('adds history transition fields and reset/undo action enum values', () => {
expect(AuctionHistoryEntrySchema.path('auctionStateTransitionId')).toBeDefined();
expect(
AuctionHistoryEntrySchema.path('auctionStateTransitionId'),
).toBeDefined();
expect(AuctionHistoryEntrySchema.path('auctionLifecycleId')).toBeDefined();
expect(AuctionHistoryEntrySchema.path('revision')).toBeDefined();
expect(AuctionHistoryEntrySchema.path('historyMutation')).toBeDefined();
expect(AuctionHistoryEntrySchema.path('matchSideEffectMutation')).toBeDefined();
expect(
AuctionHistoryEntrySchema.path('matchSideEffectMutation'),
).toBeDefined();
expect(
AuctionHistoryEntrySchema.path<string>('action').options.enum,
).toEqual(
expect.arrayContaining(['start', 'open-bidding', 'bid', 'sold', 'passed', 'next', 'complete', 'reset', 'undo']),
expect.arrayContaining([
'start',
'open-bidding',
'bid',
'sold',
'passed',
'next',
'complete',
'reset',
'undo',
]),
);
});
it('adds unique history indexes for sequence and transition idempotency', () => {
const indexes = AuctionHistoryEntrySchema.indexes();
expect(indexWithKeys(indexes, { auctionId: 1, sequence: 1 })?.[1]).toMatchObject({
expect(
indexWithKeys(indexes, { auctionId: 1, sequence: 1 })?.[1],
).toMatchObject({
unique: true,
});
expect(
indexWithKeys(indexes, { auctionId: 1, auctionStateTransitionId: 1 })?.[1],
indexWithKeys(indexes, {
auctionId: 1,
auctionStateTransitionId: 1,
})?.[1],
).toMatchObject({ unique: true, sparse: true });
});
it('registers auction side effect application model with lease fields and unique idempotency index', () => {
expect(AuctionSideEffectApplicationSchema.path('processingOwnerToken')).toBeDefined();
expect(
AuctionSideEffectApplicationSchema.path('processingLeaseExpiresAtTimestampMS'),
AuctionSideEffectApplicationSchema.path('processingOwnerToken'),
).toBeDefined();
expect(
AuctionSideEffectApplicationSchema.path(
'processingLeaseExpiresAtTimestampMS',
),
).toBeDefined();
expect(
AuctionSideEffectApplicationSchema.path('payloadChecksum'),
).toBeDefined();
expect(AuctionSideEffectApplicationSchema.path('payloadChecksum')).toBeDefined();
const indexes = AuctionSideEffectApplicationSchema.indexes();
expect(
@@ -45,7 +45,10 @@ export async function migrateAuctionPassHistory(
};
}> = [];
for await (const doc of db.collection('auction').find({}).limit(options.limit ?? 0)) {
for await (const doc of db
.collection('auction')
.find({})
.limit(options.limit ?? 0)) {
stats.scannedAuctions += 1;
const set: Record<string, unknown> = {};
let changed = false;
@@ -27,17 +27,21 @@ function createDb(params: {
},
};
},
async bulkWrite(writes: Array<{
updateOne: {
filter: { _id: unknown };
update: {
$set: Record<string, unknown>;
$unset: Record<string, ''>;
async bulkWrite(
writes: Array<{
updateOne: {
filter: { _id: unknown };
update: {
$set: Record<string, unknown>;
$unset: Record<string, ''>;
};
};
};
}>) {
}>,
) {
for (const write of writes) {
const doc = docs.find((item) => item._id === write.updateOne.filter._id);
const doc = docs.find(
(item) => item._id === write.updateOne.filter._id,
);
if (!doc) continue;
Object.assign(doc, write.updateOne.update.$set);
for (const key of Object.keys(write.updateOne.update.$unset)) {
@@ -57,7 +61,10 @@ describe('migrateTeamIndex', () => {
auctions: [
{
_id: 'auction-1',
teams: [{ side: 'blue', groupIndex: 1 }, { side: 'red', groupIndex: 1 }],
teams: [
{ side: 'blue', groupIndex: 1 },
{ side: 'red', groupIndex: 1 },
],
bids: [{ side: 'red', groupIndex: 1, amount: 100 }],
currentBidder: 'red',
currentBidderGroupIndex: 1,
@@ -66,7 +73,10 @@ describe('migrateTeamIndex', () => {
matches: [
{
_id: 'match-1',
teams: [{ side: 'blue', groupIndex: 1 }, { side: 'red', groupIndex: 1 }],
teams: [
{ side: 'blue', groupIndex: 1 },
{ side: 'red', groupIndex: 1 },
],
result: {
winnerSide: 'blue',
blueScore: 1,
@@ -112,7 +122,10 @@ describe('migrateTeamIndex', () => {
currentBidderTeamIndex: 2,
});
expect(collections.match[0]).toMatchObject({
teams: [{ teamIndex: 1, name: '1팀' }, { teamIndex: 2, name: '2팀' }],
teams: [
{ teamIndex: 1, name: '1팀' },
{ teamIndex: 2, name: '2팀' },
],
result: {
winnerTeamIndex: 1,
games: [
@@ -45,8 +45,20 @@ export async function migrateTeamIndex(
changedMatches: 0,
};
await migrateCollection(db.collection('auction'), options.limit, dryRun, stats, 'auction');
await migrateCollection(db.collection('match'), options.limit, dryRun, stats, 'match');
await migrateCollection(
db.collection('auction'),
options.limit,
dryRun,
stats,
'auction',
);
await migrateCollection(
db.collection('match'),
options.limit,
dryRun,
stats,
'match',
);
return stats;
}
@@ -60,7 +72,7 @@ async function migrateCollection(
) {
const cursor = collection.find({}).limit(limit ?? 0);
const writes: Array<{
updateOne: {
updateOne: {
filter: { _id: unknown };
update: { $set: Record<string, unknown>; $unset: Record<string, ''> };
};
@@ -143,7 +155,8 @@ function migrateMatch(doc: AnyDoc) {
const migrated = { ...team };
const teamIndex = readTeamIndex(migrated);
if (teamIndex !== undefined) migrated.teamIndex = teamIndex;
if (!migrated.name && typeof teamIndex === 'number') migrated.name = `${teamIndex}팀`;
if (!migrated.name && typeof teamIndex === 'number')
migrated.name = `${teamIndex}팀`;
if ('side' in migrated || 'groupIndex' in migrated) changed = true;
delete migrated.side;
delete migrated.groupIndex;
@@ -200,7 +213,10 @@ function migrateResult(result: Record<string, unknown>) {
migrated.games = games;
const seriesResults = asArray(result.seriesResults).map((series) => {
if (typeof series.teamAIndex === 'number' && typeof series.teamBIndex === 'number') {
if (
typeof series.teamAIndex === 'number' &&
typeof series.teamBIndex === 'number'
) {
return series;
}
changed = true;
@@ -216,7 +232,9 @@ function migrateResult(result: Record<string, unknown>) {
const teamBIndex = Math.max(legacyBlueTeamIndex, legacyRedTeamIndex);
const blueScore = numberOrDefault(series.blueScore, 0);
const redScore = numberOrDefault(series.redScore, 0);
const winnerSide = isSide(series.winnerSide) ? series.winnerSide : undefined;
const winnerSide = isSide(series.winnerSide)
? series.winnerSide
: undefined;
const winnerTeamIndex =
winnerSide === 'blue'
? legacyBlueTeamIndex
@@ -231,7 +249,8 @@ function migrateResult(result: Record<string, unknown>) {
winnerTeamIndex,
};
});
migrated.seriesResults = seriesResults.length > 0 ? seriesResults : buildSeries(games);
migrated.seriesResults =
seriesResults.length > 0 ? seriesResults : buildSeries(games);
if (typeof migrated.winnerTeamIndex !== 'number') {
const migratedSeriesResults = Array.isArray(migrated.seriesResults)
@@ -244,7 +263,11 @@ function migrateResult(result: Record<string, unknown>) {
: undefined);
}
if ('winnerSide' in migrated || 'blueScore' in migrated || 'redScore' in migrated) {
if (
'winnerSide' in migrated ||
'blueScore' in migrated ||
'redScore' in migrated
) {
changed = true;
}
delete migrated.winnerSide;
@@ -272,8 +295,12 @@ function buildSeries(games: Record<string, unknown>[]) {
const teamAIndex = Math.min(blueTeamIndex, redTeamIndex);
const teamBIndex = Math.max(blueTeamIndex, redTeamIndex);
const key = `${teamAIndex}:${teamBIndex}`;
const current =
bySeries.get(key) ?? { teamAIndex, teamBIndex, teamAWins: 0, teamBWins: 0 };
const current = bySeries.get(key) ?? {
teamAIndex,
teamBIndex,
teamAWins: 0,
teamBWins: 0,
};
if (winnerTeamIndex === teamAIndex) current.teamAWins += 1;
if (winnerTeamIndex === teamBIndex) current.teamBWins += 1;
current.winnerTeamIndex =
@@ -331,5 +358,7 @@ function numberOrDefault(value: unknown, fallback: number) {
}
function numberOrUndefined(value: unknown) {
return typeof value === 'number' && Number.isFinite(value) ? value : undefined;
return typeof value === 'number' && Number.isFinite(value)
? value
: undefined;
}
@@ -30,20 +30,26 @@ function createDb(params: { auctions?: Doc[]; history?: Doc[] }) {
},
};
},
async bulkWrite(writes: Array<{
updateOne: {
filter: { _id: unknown };
update: {
$set?: Record<string, unknown>;
$unset?: Record<string, ''>;
async bulkWrite(
writes: Array<{
updateOne: {
filter: { _id: unknown };
update: {
$set?: Record<string, unknown>;
$unset?: Record<string, ''>;
};
};
};
}>) {
}>,
) {
for (const write of writes) {
const doc = docs.find((item) => item._id === write.updateOne.filter._id);
const doc = docs.find(
(item) => item._id === write.updateOne.filter._id,
);
if (!doc) continue;
Object.assign(doc, write.updateOne.update.$set ?? {});
for (const key of Object.keys(write.updateOne.update.$unset ?? {})) {
for (const key of Object.keys(
write.updateOne.update.$unset ?? {},
)) {
delete doc[key];
}
}
@@ -31,7 +31,10 @@ interface MigrationStats {
}
type AnyDoc = Record<string, unknown> & { _id: unknown };
type UpdateDoc = { $set?: Record<string, unknown>; $unset?: Record<string, ''> };
type UpdateDoc = {
$set?: Record<string, unknown>;
$unset?: Record<string, ''>;
};
const AUCTION_FIELD_RENAMES: Array<{
from: string;
@@ -43,7 +46,11 @@ const AUCTION_FIELD_RENAMES: Array<{
{ from: 'passedQueue', to: 'passedAuctionPlayerQueue' },
{ from: 'auctionRound', to: 'currentAuctionRound' },
{ from: 'currentIndex', to: 'currentAuctionPlayerOrderIndex' },
{ from: 'bids', to: 'auctionBidHistory', transform: transformAuctionBidHistory },
{
from: 'bids',
to: 'auctionBidHistory',
transform: transformAuctionBidHistory,
},
{ from: 'currentBid', to: 'currentHighestBidPointAmount' },
{ from: 'currentBidderTeamIndex', to: 'currentHighestBidderTeamIndex' },
{
@@ -157,7 +164,8 @@ async function countDuplicateHistorySequences(
const duplicates = new Set<string>();
for await (const doc of collection.find({}).limit(limit ?? 0)) {
const auctionId = stringifyId(doc.auctionId);
const sequence = typeof doc.sequence === 'number' ? doc.sequence : undefined;
const sequence =
typeof doc.sequence === 'number' ? doc.sequence : undefined;
if (!auctionId || sequence === undefined) continue;
const key = `${auctionId}:${sequence}`;
@@ -5,10 +5,7 @@ import { NestFactory } from '@nestjs/core';
import mongoose from 'mongoose';
import { readFile } from 'node:fs/promises';
import { resolve } from 'node:path';
import {
ConnectionService,
resolveMongoDbName,
} from '../connection.service';
import { ConnectionService, resolveMongoDbName } from '../connection.service';
import type {
MatchDocument,
MatchGameAssignment,
@@ -214,12 +211,16 @@ async function main() {
printPlan(options, match, codes, plan);
if (options.dryRun) {
console.log('No writes were made. Re-run with --apply to update MongoDB.');
console.log(
'No writes were made. Re-run with --apply to update MongoDB.',
);
return;
}
const now = new Date();
const session = await (await connectionService.getConnection()).startSession();
const session = await (
await connectionService.getConnection()
).startSession();
try {
await session.withTransaction(async () => {
await applyTournamentCodeUpdates(plan, now, session);
@@ -230,9 +231,9 @@ async function main() {
status: 'finished',
roundRobinMaxRounds: options.maxRounds,
gameSchedule: plan.schedule,
tournamentCodeIds: [
...plan.usedCodeByOldGameNumber.values(),
].map((code) => code._id),
tournamentCodeIds: [...plan.usedCodeByOldGameNumber.values()].map(
(code) => code._id,
),
resultPollState: {
startedAt: match.resultPollState?.startedAt ?? now,
lastPolledAt: now,
@@ -423,7 +424,9 @@ function partitionIntoRounds(
}
if (!fillRound(0)) {
throw new Error('Could not partition result games into simultaneous rounds.');
throw new Error(
'Could not partition result games into simultaneous rounds.',
);
}
return rounds;
@@ -586,8 +589,7 @@ function buildSeriesResults(games: MatchGameResult[]): MatchSeriesResult[] {
}
return [...bySeries.values()].sort(
(left, right) =>
left.teamAIndex - right.teamAIndex ||
left.teamBIndex - right.teamBIndex,
left.teamAIndex - right.teamAIndex || left.teamBIndex - right.teamBIndex,
);
}
@@ -219,9 +219,9 @@ async function listDuplicateHistorySequences(
.toArray();
}
function printDuplicateHistorySequences(groups: Awaited<
ReturnType<typeof listDuplicateHistorySequences>
>) {
function printDuplicateHistorySequences(
groups: Awaited<ReturnType<typeof listDuplicateHistorySequences>>,
) {
if (groups.length === 0) {
console.log('No duplicate auctionHistory auctionId+sequence groups found.');
return;
@@ -248,7 +248,8 @@ async function repairDuplicateHistorySequences(
): Promise<DuplicateSequenceRepairStats> {
const historyCollection = db.collection('auctionHistory');
const auctionCollection = db.collection('auction');
const affectedAuctionIds = await findAuctionIdsWithDuplicateHistorySequences(db);
const affectedAuctionIds =
await findAuctionIdsWithDuplicateHistorySequences(db);
const stats: DuplicateSequenceRepairStats = {
affectedAuctions: affectedAuctionIds.length,
changedAuctionSequenceFields: 0,
@@ -177,7 +177,9 @@ function parseArgs(argv: string[]): CliOptions {
function parseCommitQuorum(value: string | undefined, label: string) {
if (!value) {
throw new Error(`${label} requires a positive integer, majority, or votingMembers.`);
throw new Error(
`${label} requires a positive integer, majority, or votingMembers.`,
);
}
if (value === 'majority' || value === 'votingMembers') return value;
return parsePositiveInteger(value, label);
@@ -230,9 +232,7 @@ function printDuplicateGroups(groups: TournamentCodeDuplicateGroupSummary[]) {
kind: group.kind,
loserCodes: group.losers.map((loser) => loser.code ?? '').join(', '),
loserIds: group.losers.map((loser) => loser.id).join(', '),
loserStates: group.losers
.map((loser) => loser.state ?? '')
.join(', '),
loserStates: group.losers.map((loser) => loser.state ?? '').join(', '),
})),
);
}
@@ -46,19 +46,20 @@ export function applyMongoosePerformancePlugin(schema: mongoose.Schema): void {
query[QUERY_PERFORMANCE_RECORDED] = false;
});
hookableSchema.post(
QUERY_OPERATION_REGEX,
function (result: unknown) {
recordQueryPerformance(
this as unknown as QueryWithPerformanceState,
result,
);
},
);
hookableSchema.post(QUERY_OPERATION_REGEX, function (result: unknown) {
recordQueryPerformance(
this as unknown as QueryWithPerformanceState,
result,
);
});
hookableSchema.post(
QUERY_OPERATION_REGEX,
function (error: unknown, _result: unknown, next: (error: unknown) => void) {
function (
error: unknown,
_result: unknown,
next: (error: unknown) => void,
) {
recordQueryPerformance(
this as unknown as QueryWithPerformanceState,
undefined,
@@ -80,7 +81,11 @@ export function applyMongoosePerformancePlugin(schema: mongoose.Schema): void {
hookableSchema.post(
'aggregate',
function (error: unknown, _result: unknown, next: (error: unknown) => void) {
function (
error: unknown,
_result: unknown,
next: (error: unknown) => void,
) {
recordAggregatePerformance(
this as AggregateWithPerformanceState,
undefined,
@@ -164,8 +169,8 @@ export function countHydratedDocuments(result: unknown): number {
function isHydratedDocument(value: unknown): boolean {
return Boolean(
value &&
typeof value === 'object' &&
'$__' in (value as Record<string, unknown>),
typeof value === 'object' &&
'$__' in (value as Record<string, unknown>),
);
}
@@ -11,9 +11,7 @@ interface NewRelicCustomEventApi {
eventType: string,
attributes: Record<string, NewRelicAttributeValue>,
): void;
addCustomAttributes(
attributes: Record<string, NewRelicAttributeValue>,
): void;
addCustomAttributes(attributes: Record<string, NewRelicAttributeValue>): void;
setTransactionName(name: string): void;
}
const agent = newrelicAgent as unknown as NewRelicCustomEventApi;
@@ -52,8 +52,7 @@ export interface ApiRequestPerformanceEvent {
leanQueryCount: number;
}
export interface MongooseQueryPerformanceEvent
extends MongooseQueryPerformance {
export interface MongooseQueryPerformanceEvent extends MongooseQueryPerformance {
type: 'mongoose-query';
timestamp: string;
requestId?: string;
@@ -92,10 +91,7 @@ export function resolveApiPerformanceConfig(
const enabled = readBoolean(env.API_PERF_OBSERVABILITY_ENABLED, false);
return {
enabled,
localEventsEnabled: readBoolean(
env.API_PERF_LOCAL_EVENTS_ENABLED,
enabled,
),
localEventsEnabled: readBoolean(env.API_PERF_LOCAL_EVENTS_ENABLED, enabled),
localEventFile:
env.API_PERF_LOCAL_EVENT_FILE || '/tmp/lolympus-api-performance.ndjson',
newRelicRequestEventsEnabled: readBoolean(
@@ -35,8 +35,7 @@ export interface RunWithDistributedLockOptions {
lockRetryDelayMilliseconds?: number;
}
export interface RunWithRenewedDistributedLockOptions
extends RunWithDistributedLockOptions {
export interface RunWithRenewedDistributedLockOptions extends RunWithDistributedLockOptions {
lockRenewalIntervalMilliseconds: number;
}
@@ -55,14 +54,16 @@ export class DistributedLockService {
);
const lockOwnershipToken = options.lockOwnershipToken ?? randomUUID();
const result = await this.redisService.raw().sendCommand([
'SET',
options.lockKey,
lockOwnershipToken,
'NX',
'PX',
String(options.lockExpirationDurationMilliseconds),
]);
const result = await this.redisService
.raw()
.sendCommand([
'SET',
options.lockKey,
lockOwnershipToken,
'NX',
'PX',
String(options.lockExpirationDurationMilliseconds),
]);
if (String(result) !== 'OK') return null;
return {
@@ -76,34 +77,37 @@ export class DistributedLockService {
public async releaseLockIfOwned(
lockOwnership: DistributedLockOwnership,
): Promise<boolean> {
const result = await this.redisService.raw().sendCommand([
'EVAL',
RELEASE_LOCK_IF_OWNED_SCRIPT,
'1',
lockOwnership.lockKey,
lockOwnership.lockOwnershipToken,
]);
const result = await this.redisService
.raw()
.sendCommand([
'EVAL',
RELEASE_LOCK_IF_OWNED_SCRIPT,
'1',
lockOwnership.lockKey,
lockOwnership.lockOwnershipToken,
]);
return Number(result) === 1;
}
public async extendLockIfOwned(
lockOwnership: DistributedLockOwnership,
lockExpirationDurationMilliseconds =
lockOwnership.lockExpirationDurationMilliseconds,
lockExpirationDurationMilliseconds = lockOwnership.lockExpirationDurationMilliseconds,
): Promise<boolean> {
this.assertPositiveDuration(
lockExpirationDurationMilliseconds,
'lockExpirationDurationMilliseconds',
);
const result = await this.redisService.raw().sendCommand([
'EVAL',
EXTEND_LOCK_IF_OWNED_SCRIPT,
'1',
lockOwnership.lockKey,
lockOwnership.lockOwnershipToken,
String(lockExpirationDurationMilliseconds),
]);
const result = await this.redisService
.raw()
.sendCommand([
'EVAL',
EXTEND_LOCK_IF_OWNED_SCRIPT,
'1',
lockOwnership.lockKey,
lockOwnership.lockOwnershipToken,
String(lockExpirationDurationMilliseconds),
]);
return Number(result) === 1;
}
@@ -25,7 +25,9 @@ async function readFirstSecret(
{
provide: REDIS_CLIENT,
inject: [SecretService],
useFactory: async (secretService: SecretService): Promise<RedisClient> => {
useFactory: async (
secretService: SecretService,
): Promise<RedisClient> => {
await secretService.ready();
const [url, endpoint, username, password] = await Promise.all([
@@ -6,15 +6,17 @@ function createRedisService(client: Record<string, unknown>) {
describe('RedisService stream pending recovery', () => {
it('normalizes XAUTOCLAIM array replies into stream entries', async () => {
const sendCommand = jest.fn().mockResolvedValue([
'0-0',
[
const sendCommand = jest
.fn()
.mockResolvedValue([
'0-0',
[
'1700000000000-0',
['job', '{"kind":"poll-tournament-result"}', 'source', 'test'],
[
'1700000000000-0',
['job', '{"kind":"poll-tournament-result"}', 'source', 'test'],
],
],
],
]);
]);
const service = createRedisService({ sendCommand });
await expect(
@@ -223,9 +223,7 @@ export class RedisService implements OnModuleDestroy {
])) as unknown;
const responseItems = Array.isArray(response) ? response : [];
const rawMessages = Array.isArray(responseItems[1])
? responseItems[1]
: [];
const rawMessages = Array.isArray(responseItems[1]) ? responseItems[1] : [];
return {
nextStartId: String(responseItems[0] ?? '0-0'),
@@ -258,7 +256,9 @@ export class RedisService implements OnModuleDestroy {
return this.client.publish(channel, message);
}
private normalizeClaimedStreamMessage(rawMessage: unknown): StreamEntry | null {
private normalizeClaimedStreamMessage(
rawMessage: unknown,
): StreamEntry | null {
if (Array.isArray(rawMessage)) {
const [id, fields] = rawMessage;
if (id === undefined) return null;