Bolt.Sips v2.0.5 Bolt.Sips.LoadBalancer View Source

a simple load balancer used for selecting a server address from a map. The address is selected based on how many hits has; least reused url.

Link to this section Summary

Functions

sort by total number of hits and return the least reused url

Link to this section Functions

Link to this function

least_reused_url(urls)

View Source
least_reused_url(map()) :: {:ok, String.t()} | {:error, :not_found}

sort by total number of hits and return the least reused url

## Examples

iex> least_reused_url(%{"url1" => 10, "url2" => 5})
{:ok, "url2"}

iex> least_reused_url(%{})
{:error, :not_found}