pub fn install_posthog_client(client: Option<Arc<Client>>)Expand description
Installs client into the shared PostHog slot, replacing any previous
value.
Pass None to clear the slot. serve() always calls this — with either
the freshly built client, or None when no API key is configured on the
current run — so that a stale or already-shutdown client from a previous
server startup in the same process cannot linger into a subsequent run
and silently receive analytics against outdated configuration.
If the slot’s RwLock is poisoned, the install is skipped and a warning
is logged; subsequent captures will find no client, disabling PostHog
for the rest of the process. This is safer than leaving a stale value in
place: no analytics is preferable to analytics sent to the wrong
destination.