fix(ai): STT httpc только IPv4 — таймаут на хостах без IPv6
CI / test (push) Successful in 7m10s
CI / deploy-ift (push) Successful in 3m19s
CI / e2e-ift (push) Successful in 1m17s
CI / deploy-stage (push) Successful in 2m16s
CI / e2e-stage (push) Successful in 1m15s

На stage прямой режим к api.x.ai падал upstream_error ровно через
STT_TIMEOUT_MS: DNS Erlang отдаёт AAAA первым, IPv6-маршрута на хосте
нет, httpc с дефолтным inet6fb4 висит на connect до таймаута
(curl/wget с happy-eyeballs проходили). ipfamily=inet на профиле
eventhub_stt; IFT (прямой) и прокси-режим не затрагиваются.
This commit is contained in:
2026-08-22 23:41:29 +03:00
parent 4486dc87db
commit b122cf3339
+8 -2
View File
@@ -172,11 +172,17 @@ default_http_post(Url, Headers, ContentType, Body) ->
%% к STT-апстриму, остальные httpc-вызовы не затрагиваются. %% к STT-апстриму, остальные httpc-вызовы не затрагиваются.
ensure_profile() -> ensure_profile() ->
case inets:start(httpc, [{profile, ?HTTP_PROFILE}]) of case inets:start(httpc, [{profile, ?HTTP_PROFILE}]) of
{ok, _Pid} -> apply_proxy(); {ok, _Pid} -> apply_profile_opts();
{error, {already_started, _Pid}} -> apply_proxy(); {error, {already_started, _Pid}} -> apply_profile_opts();
_ -> ok _ -> ok
end. end.
apply_profile_opts() ->
%% Только IPv4: на хостах без IPv6-маршрута httpc с дефолтным
%% inet6fb4 висит до таймаута, если AAAA приходит первым.
httpc:set_options([{ipfamily, inet}], ?HTTP_PROFILE),
apply_proxy().
apply_proxy() -> apply_proxy() ->
case parse_proxy(proxy_url()) of case parse_proxy(proxy_url()) of
{ok, Host, Port} -> {ok, Host, Port} ->