perf: expand gateway capacity and prevent receipt replay
This commit is contained in:
@@ -3355,6 +3355,14 @@ describe('SendChainService', () => {
|
||||
'delivery-once',
|
||||
]);
|
||||
expect(service['postGatewayControl']).toHaveBeenCalledTimes(1);
|
||||
expect(service['postGatewayControl']).toHaveBeenCalledWith(
|
||||
'/downstream/receipt',
|
||||
expect.objectContaining({ deliveryId: 'delivery-once', claimId: expect.stringMatching(/^api-direct:/) }),
|
||||
);
|
||||
expect(prisma.cmppDownstreamDelivery.updateMany).toHaveBeenCalledWith(expect.objectContaining({
|
||||
where: { id: 'delivery-once', status: 'pending' },
|
||||
data: expect.objectContaining({ status: 'dispatching', connectionId: expect.stringMatching(/^api-direct:/) }),
|
||||
}));
|
||||
expect(prisma.cmppDownstreamDelivery.create).toHaveBeenCalledTimes(3);
|
||||
});
|
||||
|
||||
@@ -3895,8 +3903,12 @@ describe('SendChainService', () => {
|
||||
});
|
||||
prisma.cmppDownstreamDelivery.findMany.mockResolvedValue([]);
|
||||
|
||||
await expect(service.listPendingDownstreamDeliveries({ account: '100001', limit: 100 }))
|
||||
prisma.$queryRaw.mockResolvedValueOnce([]);
|
||||
await expect(service.listPendingDownstreamDeliveries({ account: '100001', limit: 100, claimId: 'gateway-a:100001:1' }))
|
||||
.resolves.toEqual([]);
|
||||
const claimSql = prisma.$queryRaw.mock.calls[0][0].strings.join(' ');
|
||||
expect(claimSql).toContain('FOR UPDATE SKIP LOCKED');
|
||||
expect(claimSql).toContain("status = 'dispatching'");
|
||||
});
|
||||
|
||||
it('persists each upstream SubmitResp segment before the aggregate result arrives', async () => {
|
||||
|
||||
Reference in New Issue
Block a user