Skip to content

Commit fc70445

Browse files
authored
fix: Make gun open errors explicitly into temporary failures (#118)
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>
1 parent b7065aa commit fc70445

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/ldclient_update_stream_server.erl

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -163,9 +163,9 @@ do_listen(Uri, FeatureStore, Tag, GunOpts, Headers) ->
163163
Opts = #{gun_opts => GunOpts},
164164
case shotgun:open(Host, Port, Scheme, Opts) of
165165
{error, gun_open_failed} ->
166-
{error, gun_open_failed, "Could not open connection to host"};
166+
{error, temporary, "Could not open connection to host"};
167167
{error, gun_open_timeout} ->
168-
{error, gun_open_timeout, "Connection timeout"};
168+
{error, temporary, "Connection timeout"};
169169
{ok, Pid} ->
170170
_ = monitor(process, Pid),
171171
F = fun(nofin, _Ref, Bin) ->

0 commit comments

Comments
 (0)