fix(pi): single-flight managed extension materialization
This commit is contained in:
@@ -35,6 +35,26 @@ async function post(
|
||||
}
|
||||
|
||||
describe('managed Pi extension bridge', () => {
|
||||
it('single-flights the shared managed extension for concurrent worker registration', async () => {
|
||||
const root = await mkdtemp(path.join(tmpdir(), 'makelore-pi-extension-concurrent-'));
|
||||
roots.push(root);
|
||||
const host = new PiManagedExtensionHost();
|
||||
hosts.push(host);
|
||||
|
||||
const registrations = await Promise.all(Array.from({ length: 8 }, async (_, index) => (
|
||||
await host.registerWorker({
|
||||
conversationId: `conversation-${index + 1}`,
|
||||
generation: 1,
|
||||
projectId: `project-${index + 1}`,
|
||||
extensionsDir: root,
|
||||
})
|
||||
)));
|
||||
|
||||
expect(new Set(registrations.map(({ extensionPath }) => extensionPath)).size).toBe(1);
|
||||
expect(host.getDiagnostics().registrations).toEqual({ parent: 8, child: 0 });
|
||||
await Promise.all(registrations.map(({ dispose }) => dispose()));
|
||||
});
|
||||
|
||||
it('finishes a queued HTTP request while closing a holder and waiter', async () => {
|
||||
const root = await mkdtemp(path.join(tmpdir(), 'makelore-pi-extension-close-'));
|
||||
roots.push(root);
|
||||
|
||||
Reference in New Issue
Block a user