Creates a function that runs an asynchronous initializer at most once, caching the promise so
concurrent and subsequent calls share the same initialization attempt. If the initializer fails,
the cached promise is cleared so the next call starts a fresh attempt instead of failing forever
with the same error. This is useful for initializing access to a resource that may not be
available yet, like a network object owned by a process that is still starting up.
Note that calls that awaited the failed attempt all reject with its error; only calls arriving
after the rejection settles retry. The initializer must therefore be safe to run again after a
failure, e.g. it should not leave partial registrations behind.
Creates a function that runs an asynchronous initializer at most once, caching the promise so concurrent and subsequent calls share the same initialization attempt. If the initializer fails, the cached promise is cleared so the next call starts a fresh attempt instead of failing forever with the same error. This is useful for initializing access to a resource that may not be available yet, like a network object owned by a process that is still starting up.
Note that calls that awaited the failed attempt all reject with its error; only calls arriving after the rejection settles retry. The initializer must therefore be safe to run again after a failure, e.g. it should not leave partial registrations behind.