Skip to main content

install

Function install 

Source
pub fn install(options: RuntimeOptions) -> Result<()>
Expand description

Configure the shared scheduler and register it as this addon’s napi AsyncRuntime backend.

Call this from the host’s own #[napi_derive::module_init] hook, after resolving the process configuration (environment variables, defaults) into RuntimeOptions. The scheduler never reads the environment itself; the host owns that resolution – with ONE adapter-owned convenience: install resolves the conventional [DRAIN_LINGER_ENV] override into RuntimeOptions::drain_linger here, at the same addon-load boundary where the host resolves its variables (a present numeric value wins over the passed field; absent or non-numeric keeps it – see resolve_drain_linger). Hosts that call configure directly instead of install own that resolution too. configure validates and normalizes the options (clamping drain_linger to its ceiling), and the runtime controller’s options remain the reporting authority for getAsyncRuntimeConfig.