View Source FastCi.Servers.Websocket.Activity (FastCi v0.1.1)
Module which is meant to keep state abount the current websocket activity.
The websocket can have multiple calls at a time so trying to keep state via the original genserver can cause issues. That's why a linked agent is used, to keep the statae accross multiple processes correctly.
Summary
Functions
Get the deq request count. This is meant to be used as a treshold that if the server doesn't respond within a couple of requests, the node should exit with an error.
Get whether the websocket is performing a test. This should make any timeout logic be ignored as it's performing something so it's expected that it shouldn't do new request or have any activity.
Increments the deq request count.
Resets the deq request count back to zero
Set whether the websocket is perfoming a test. It's assumed that the second argument is true but can be replaced.
Functions
Get the deq request count. This is meant to be used as a treshold that if the server doesn't respond within a couple of requests, the node should exit with an error.
Examples
iex> get_deq_request_count(pid)
2
Get whether the websocket is performing a test. This should make any timeout logic be ignored as it's performing something so it's expected that it shouldn't do new request or have any activity.
Examples
iex> get_working?(self())
true
# ... later
iex> get_working?(self())
false
@spec increment_deq_request_count(agent_pid :: pid()) :: :ok
Increments the deq request count.
Examples
iex > get_deq_request_count(pid) 0
iex > increment_deq_request_count(pid) :ok
iex > increment_deq_request_count(pid) :ok
iex > get_deq_request_count(pid) 2
@spec reset_deq_request_count(agent_pid :: pid()) :: :ok
Resets the deq request count back to zero
Examples
iex > get_deq_request_count(pid)
2
iex > reset_deq_request_count(pid)
:ok
iex > get_deq_request_count(pid)
0
Set whether the websocket is perfoming a test. It's assumed that the second argument is true but can be replaced.
Examples
iex> set_working?(self(), true)
:ok
iex> set_working?(self(), false)
:ok