MCPcopy
hub / github.com/mongodb/node-mongodb-native / waitUntilPoolsFilled

Function waitUntilPoolsFilled

test/tools/utils.ts:414–431  ·  view source on GitHub ↗
(
  client: MongoClient,
  signal: AbortSignal,
  count: number = client.s.options.maxPoolSize
)

Source from the content-addressed store, hash-verified

412 * serve as a way to ensure that some connections have been established and are in the pools.
413 */
414export async function waitUntilPoolsFilled(
415 client: MongoClient,
416 signal: AbortSignal,
417 count: number = client.s.options.maxPoolSize
418): Promise<void> {
419 let connectionCount = 0;
420
421 async function wait$() {
422 for await (const _event of on(client, 'connectionCreated', { signal })) {
423 connectionCount++;
424 if (connectionCount >= count) {
425 break;
426 }
427 }
428 }
429
430 await Promise.all([wait$(), client.connect()]);
431}
432
433export async function configureFailPoint(
434 configuration: TestConfiguration,

Calls 2

wait$Function · 0.85
connectMethod · 0.45

Tested by

no test coverage detected