mirror of
https://github.com/seriyps/mtproto_proxy.git
synced 2026-08-04 07:08:10 +00:00
Merge pull request #118 from centuriononon/feat/configurable-api-timeouts
Make core API HTTP timeout configurable
This commit is contained in:
commit
0f042b27ad
2 changed files with 4 additions and 1 deletions
|
|
@ -309,8 +309,9 @@ http_get(Url) ->
|
|||
UserAgent = ("MTProtoProxy/" ++ Vsn ++ " OTP-" ++ OtpVersion ++
|
||||
" (+https://github.com/seriyps/mtproto_proxy)"),
|
||||
Headers = [{"User-Agent", UserAgent}],
|
||||
Timeout = application:get_env(mtproto_proxy, core_api_http_timeout_ms, 3000),
|
||||
{ok, {{_, 200, _}, _, Body}} =
|
||||
httpc:request(get, {Url, Headers}, [{timeout, 3000}], ?OPTS),
|
||||
httpc:request(get, {Url, Headers}, [{timeout, Timeout}], ?OPTS),
|
||||
{ok, Body}.
|
||||
|
||||
random_choice(L) ->
|
||||
|
|
|
|||
|
|
@ -154,6 +154,8 @@
|
|||
%% Mostly used to testing
|
||||
%% {proxy_secret_url, "https://core.telegram.org/getProxySecret"},
|
||||
%% {proxy_config_url, "https://core.telegram.org/getProxyConfig"},
|
||||
%% HTTP timeout (ms) for fetching proxy config/secret
|
||||
{core_api_http_timeout_ms, 3000}
|
||||
|
||||
%% Upstream self-healthchecks tuning
|
||||
%% {upstream_healthchecks,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue