fix(cmpp): honor UTC inbox retry leases

This commit is contained in:
hectorzhao
2026-08-20 17:50:00 +08:00
parent 0b63bcd74e
commit 53073461e9
5 changed files with 44 additions and 6 deletions
@@ -530,6 +530,7 @@ async tryReserveDailySendQuota(applicationId: string, requestedCount: number, re
throw new BadRequestException('发送号码数量必须为正整数');
}
const usageDate = shanghaiDateKey();
const usageDateValue = new Date(`${usageDate}T00:00:00.000Z`);
const reserve = (client: Pick<Prisma.TransactionClient, '$queryRaw'>) => {
const reservationId = randomUUID();
return client.$queryRaw<Array<{ tenantId: string; dailyLimit: number; usedCount: number | null }>>(Prisma.sql`
@@ -583,7 +584,7 @@ async tryReserveDailySendQuota(applicationId: string, requestedCount: number, re
reservationKey: normalizedReservationKey,
tenantId: row.tenantId,
applicationId,
usageDate,
usageDate: usageDateValue,
requestedCount,
dailyLimit: Number(row.dailyLimit),
usedCount: row.usedCount == null ? null : Number(row.usedCount),