View Source NOAA.Observations.RetriesAgent (NOAA Observations v0.4.60)

An agent process loading the maximum number of timeout retries.

Summary

Functions

Returns a specification to start this module under a supervisor.

Gets and decrements the number of timeout retries in the retries agent.

Refreshes the agent state.

Spawns an agent process that loads the maximum number of timeout retries.

Functions

child_spec(arg)

Returns a specification to start this module under a supervisor.

See Supervisor.

get_and_decrement()

@spec get_and_decrement() :: non_neg_integer()

Gets and decrements the number of timeout retries in the retries agent.

Examples

iex> alias NOAA.Observations.RetriesAgent
iex> RetriesAgent.refresh()
iex> bef_retries = RetriesAgent.get_and_decrement()
iex> aft_retries = Agent.get(& &1)
iex> aft_retries = bef_retries - 1
true

refresh()

@spec refresh() :: :ok

Refreshes the agent state.

start_link(arg)

@spec start_link(term()) :: Agent.on_start()

Spawns an agent process that loads the maximum number of timeout retries.

Examples

iex> alias NOAA.Observations.RetriesAgent
iex> {:error, {:already_started, agent}} = RetriesAgent.start_link(:ok)
iex> is_pid(agent) and agent == Process.whereis(RetriesAgent)
true