fix: 过滤通知 outbox 空扫描审计
This commit is contained in:
@@ -84,13 +84,19 @@ export class AuditService {
|
||||
orderBy: {
|
||||
createdAt: 'desc',
|
||||
},
|
||||
take: 50,
|
||||
take: 200,
|
||||
});
|
||||
|
||||
return records.map((record) => this.toSummary(record));
|
||||
return records
|
||||
.map((record) => this.toSummary(record))
|
||||
.filter((record) => !this.isEmptyRetryTick(record))
|
||||
.slice(0, 50);
|
||||
}
|
||||
|
||||
return [...this.memoryRecords].slice(-50).reverse();
|
||||
return [...this.memoryRecords]
|
||||
.reverse()
|
||||
.filter((record) => !this.isEmptyRetryTick(record))
|
||||
.slice(0, 50);
|
||||
}
|
||||
|
||||
private sanitize(input: AuditRecordInput): SanitizedAuditRecordInput {
|
||||
@@ -155,6 +161,19 @@ export class AuditService {
|
||||
return value;
|
||||
}
|
||||
|
||||
private isEmptyRetryTick(record: AuditRecordSummary): boolean {
|
||||
if (record.action !== 'NOTIFICATION_OUTBOX_RETRY_TICK_COMPLETED') {
|
||||
return false;
|
||||
}
|
||||
|
||||
return (
|
||||
record.after?.totalCandidates === 0 &&
|
||||
record.after.sentCount === 0 &&
|
||||
record.after.skippedCount === 0 &&
|
||||
record.after.failedCount === 0
|
||||
);
|
||||
}
|
||||
|
||||
private databaseClient(): PrismaService | undefined {
|
||||
if (
|
||||
!this.config?.get('USE_DATABASE_READS', { infer: true }) ||
|
||||
|
||||
Reference in New Issue
Block a user