Tracks in-flight RPC calls and provides graceful connection draining.
Uses DrainerCache (backed by Cache.Counter) to atomically track
the number of in-flight calls. During shutdown, the server leaves its
:pg group and calls drain/2 to wait for existing calls to complete
before the process terminates.
Summary
Functions
@spec drain(non_neg_integer(), timeout()) :: :ok | {:error, :timeout}
@spec in_flight_count(non_neg_integer()) :: non_neg_integer()
@spec register(atom()) :: non_neg_integer()
@spec release_call(non_neg_integer()) :: :ok
@spec track_call(non_neg_integer()) :: :ok