Skip to content

Commit

Permalink
fix: Make gun open errors explicitly into temporary failures (#118)
Browse files Browse the repository at this point in the history
Updates `gun_open_*` failures during stream initialization to translate
to `temporary` failures, as expected by the calling function.

I think these errors were always meant to be explicitly `temporary`.
Otherwise, if these are currently returned the calling `try` block
wouldn't pattern match and I believe it would crash the process. At that
point we'd be relying on the supervisor restarts instead of managed
backoff.

Co-authored-by: Zurab Davitiani <zurab@launchdarkly.com>
  • Loading branch information
zurab-darkly and zurab-darkly authored Jan 4, 2024
1 parent b7065aa commit fc70445
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/ldclient_update_stream_server.erl
Original file line number Diff line number Diff line change
Expand Up @@ -163,9 +163,9 @@ do_listen(Uri, FeatureStore, Tag, GunOpts, Headers) ->
Opts = #{gun_opts => GunOpts},
case shotgun:open(Host, Port, Scheme, Opts) of
{error, gun_open_failed} ->
{error, gun_open_failed, "Could not open connection to host"};
{error, temporary, "Could not open connection to host"};
{error, gun_open_timeout} ->
{error, gun_open_timeout, "Connection timeout"};
{error, temporary, "Connection timeout"};
{ok, Pid} ->
_ = monitor(process, Pid),
F = fun(nofin, _Ref, Bin) ->
Expand Down

0 comments on commit fc70445

Please sign in to comment.