mirror of
https://github.com/danny-avila/LibreChat.git
synced 2026-10-22 10:02:41 +00:00
fix: normalize schedule capacity conflicts
This commit is contained in:
parent
eb1475b4b3
commit
fc5dc0baa1
2 changed files with 15 additions and 1 deletions
|
|
@ -950,6 +950,15 @@ describe('scheduled resume capacity', () => {
|
|||
});
|
||||
expect(methods.markRunResumeClaimed).not.toHaveBeenCalled();
|
||||
});
|
||||
|
||||
it('normalizes an exhausted slot-collision retry to public capacity conflict', async () => {
|
||||
const { service, methods } = makeResumeService({ takenSlots: [], unslotted: 0 });
|
||||
methods.markRunResumeClaimed.mockResolvedValue({ conflict: 'slot-taken' });
|
||||
|
||||
await expect(service.claimScheduleResume('s1', '2026-08-17T12:00:00.000Z')).resolves.toEqual({
|
||||
conflict: 'capacity',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('deployment-wide limits', () => {
|
||||
|
|
|
|||
|
|
@ -855,7 +855,12 @@ export function createSchedulesService(
|
|||
}
|
||||
const claimed = allocation.claimed;
|
||||
if ('conflict' in claimed) {
|
||||
return { conflict: claimed.conflict };
|
||||
// withCapacitySlot consumes this internal collision sentinel by retrying the
|
||||
// next free slot. Normalize defensively at the public boundary as well so a
|
||||
// custom/test allocator can never leak an implementation-only conflict.
|
||||
return {
|
||||
conflict: claimed.conflict === 'slot-taken' ? 'capacity' : claimed.conflict,
|
||||
};
|
||||
}
|
||||
return { capacitySlot: claimed.capacitySlot };
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue