If autostart is provided in the config, allow an option that takes a callback to be invoked when the minimum number of connections are primed. Or alternatively, provide a promise that can be waited on to achieve the same effect.
const deferred = Promise.withResolvers()
const myPool = new genericPool.createPool(factory, {
...opts,
autostart: true,
started: deferred.resolve, // this can be a () => {} as well but am using
// Promise.withResolvers().resolve instead to allow for await
});
await deferred.promise; // now the pool has met minimum connections
and/or
const myPool = new genericPool.createPool(factory, {
...opts,
autostart: true,
});
await myPool.started; // now the pool has met minimum connections
The argument for both is that some libraries that use this code (such as the Snowflake SDK) do not expose the GenericPool directly.
If
autostart
is provided in the config, allow an option that takes a callback to be invoked when the minimum number of connections are primed. Or alternatively, provide a promise that can be waited on to achieve the same effect.and/or
The argument for both is that some libraries that use this code (such as the Snowflake SDK) do not expose the GenericPool directly.