mirror of
https://github.com/valitydev/bouncer.git
synced 2024-11-06 02:15:18 +00:00
FIX ED-64: request_timeout is not actually a connection option (#24)
This commit is contained in:
parent
133b0d5b49
commit
487395fa92
@ -25,6 +25,8 @@
|
||||
{opa, #{
|
||||
%% Endpoint of the OPA service
|
||||
endpoint => {{resolve, dns, "opa", #{pick => random}}, 8181},
|
||||
% Timeout for making request and receiving response. (ms)
|
||||
request_timeout => 1000,
|
||||
%% Pool options, see gunner_pool:pool_opts()
|
||||
pool_opts => #{
|
||||
cleanup_interval => 1000,
|
||||
@ -42,9 +44,7 @@
|
||||
% Total timeout for estabilishing a connection. (ms)
|
||||
connect_timeout => 1000,
|
||||
% Timeout for domain lookup query. (ms)
|
||||
domain_lookup_timeout => 1000,
|
||||
% Timeout for making request and receiving response. (ms)
|
||||
request_timeout => 1000
|
||||
domain_lookup_timeout => 1000
|
||||
}
|
||||
}
|
||||
}},
|
||||
|
@ -12,7 +12,8 @@
|
||||
|
||||
-type opts() :: #{
|
||||
pool_opts := gunner:pool_opts(),
|
||||
endpoint := endpoint()
|
||||
endpoint := endpoint(),
|
||||
request_timeout => timeout()
|
||||
}.
|
||||
|
||||
-opaque client() :: #{
|
||||
@ -55,7 +56,7 @@ init(OpaClientOpts) ->
|
||||
},
|
||||
Client = genlib_map:compact(#{
|
||||
endpoint => maps:get(endpoint, OpaClientOpts),
|
||||
request_timeout => get_request_timeout(PoolOpts),
|
||||
request_timeout => get_request_timeout(OpaClientOpts),
|
||||
connect_timeout => get_connect_timeout(PoolOpts)
|
||||
}),
|
||||
{Client, ChildSpec}.
|
||||
@ -135,10 +136,9 @@ make_gunner_opts(RequestTimeout, #{connect_timeout := ConnectTimeout}) ->
|
||||
make_gunner_opts(RequestTimeout, _Client) ->
|
||||
#{request_timeout => RequestTimeout}.
|
||||
|
||||
-spec get_request_timeout(gunner:pool_opts()) -> timeout().
|
||||
get_request_timeout(PoolOpts) ->
|
||||
ClientOpts = maps:get(connection_opts, PoolOpts, #{}),
|
||||
maps:get(request_timeout, ClientOpts, ?DEFAULT_REQUEST_TIMEOUT).
|
||||
-spec get_request_timeout(opts()) -> timeout().
|
||||
get_request_timeout(Opts) ->
|
||||
maps:get(request_timeout, Opts, ?DEFAULT_REQUEST_TIMEOUT).
|
||||
|
||||
-spec get_connect_timeout(gunner:pool_opts()) -> timeout() | undefined.
|
||||
get_connect_timeout(PoolOpts) ->
|
||||
|
@ -124,6 +124,7 @@ start_bouncer(Env, C) ->
|
||||
}},
|
||||
{opa, #{
|
||||
endpoint => ?OPA_ENDPOINT_RESOLVE,
|
||||
request_timeout => 1000,
|
||||
pool_opts => #{
|
||||
connection_opts => #{
|
||||
transport => tcp
|
||||
|
Loading…
Reference in New Issue
Block a user