Skip to main content

BeforeAcquireHook

Type Alias BeforeAcquireHook 

Source
pub type BeforeAcquireHook = Arc<dyn Fn(&AsyncConnection) -> HookFuture<'_> + Send + Sync + 'static>;
Expand description

A hook that runs every time a connection is checked out of the pool, before it is handed to the caller. Use it for per-acquire health checks, session resets, or telemetry.

Returning Err from the hook causes the connection to be evicted (the pool retries with another connection or builds a new one).

Aliased Typeยง

pub struct BeforeAcquireHook { /* private fields */ }