in src/load.ts [28:58]
export async function load(
connectionStringOrEndpoint: string | URL,
credentialOrOptions?: TokenCredential | AzureAppConfigurationOptions,
appConfigOptions?: AzureAppConfigurationOptions
): Promise<AzureAppConfiguration> {
const startTimestamp = Date.now();
let options: AzureAppConfigurationOptions | undefined;
const clientManager = new ConfigurationClientManager(connectionStringOrEndpoint, credentialOrOptions, appConfigOptions);
await clientManager.init();
if (!instanceOfTokenCredential(credentialOrOptions)) {
options = credentialOrOptions as AzureAppConfigurationOptions;
} else {
options = appConfigOptions;
}
try {
const appConfiguration = new AzureAppConfigurationImpl(clientManager, options);
await appConfiguration.load();
return appConfiguration;
} catch (error) {
// load() method is called in the application's startup code path.
// Unhandled exceptions cause application crash which can result in crash loops as orchestrators attempt to restart the application.
// Knowing the intended usage of the provider in startup code path, we mitigate back-to-back crash loops from overloading the server with requests by waiting a minimum time to propagate fatal errors.
const delay = MIN_DELAY_FOR_UNHANDLED_ERROR - (Date.now() - startTimestamp);
if (delay > 0) {
await new Promise((resolve) => setTimeout(resolve, delay));
}
throw error;
}
}