Merge pull request #118 from centuriononon/feat/configurable-api-timeouts

Make core API HTTP timeout configurable
This commit is contained in:
Sergey Prokhorov 2026-04-12 03:52:49 +02:00 committed by GitHub
commit 0f042b27ad
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 4 additions and 1 deletions

View file

@ -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) ->

View file

@ -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,