Add timeout parameter to ICEAgent.get_stats/2#108
Conversation
There was a problem hiding this comment.
Pull request overview
This PR extends the public ExICE.ICEAgent.get_stats API to allow callers to control the GenServer.call/3 timeout when retrieving ICE statistics, which can help avoid unwanted call timeouts (or allow faster failure) depending on runtime conditions.
Changes:
- Add an optional
timeoutparameter toExICE.ICEAgent.get_stats/2and pass it through toGenServer.call/3. - Update the
get_statstypespec to include the timeout parameter.
Comments suppressed due to low confidence (1)
lib/ex_ice/ice_agent.ex:283
def get_stats/2uses a default argument, so the module still exportsget_stats/1as well asget_stats/2. The current typespec only coversget_stats/2, which can cause Dialyzer/docs to treatget_stats/1as undocumented/unknown. Consider introducing a namedstats()type and adding specs for both arities; also document the newtimeoutparameter in the@docsince it’s now part of the public API.
@spec get_stats(pid(), timeout()) :: %{
bytes_sent: non_neg_integer(),
bytes_received: non_neg_integer(),
packets_sent: non_neg_integer(),
packets_received: non_neg_integer(),
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #108 +/- ##
==========================================
- Coverage 87.61% 87.52% -0.10%
==========================================
Files 27 27
Lines 2140 2140
==========================================
- Hits 1875 1873 -2
- Misses 265 267 +2
... and 1 file with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
Uses the new timeout param from ex_ice (elixir-webrtc/ex_ice#108) instead of calling into the ICE agent's GenServer directly. Temporarily depends on the ex_ice branch until 0.16.1 is on hex.
No description provided.