perf: streamline repository and deployment awareness
ForgeFlow quality gate / quality (push) Canceled after 0s
ForgeFlow quality gate / quality (push) Canceled after 0s
This commit is contained in:
@@ -172,3 +172,22 @@ test('rollback refuses a stale target that is no longer the server-reported prev
|
||||
assert.equal(dispatched, false);
|
||||
});
|
||||
|
||||
test('active deployment refreshes run concurrently with a bounded worker pool', async () => {
|
||||
const operations = Array.from({ length: 9 }, (_, index) => ({ id: `operation-${index}`, type: 'deployment', status: 'running' }));
|
||||
const service = new DeploymentService({ data: { operations } }, {}, {});
|
||||
let running = 0;
|
||||
let peak = 0;
|
||||
service.refreshOperation = async (id) => {
|
||||
running += 1;
|
||||
peak = Math.max(peak, running);
|
||||
await new Promise((resolve) => setTimeout(resolve, 10));
|
||||
running -= 1;
|
||||
return { id };
|
||||
};
|
||||
|
||||
const refreshed = await service.refreshActiveOperations();
|
||||
assert.equal(refreshed.length, operations.length);
|
||||
assert.ok(peak > 1);
|
||||
assert.ok(peak <= 4);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user