Skip to content

New routing 2#201

Open
WWWcool wants to merge 7 commits intomasterfrom
tmp_routing_2
Open

New routing 2#201
WWWcool wants to merge 7 commits intomasterfrom
tmp_routing_2

Conversation

@WWWcool
Copy link
Copy Markdown
Contributor

@WWWcool WWWcool commented Mar 26, 2026

No description provided.

Comment thread apps/routing/src/hg_route_fd.erl Outdated

build_route_map(Route, #{service_ids := ServiceIDs, service_map := ServiceMap, routes := RouteMap}) ->
#domain_ProviderRef{id = ProviderID} = hg_route:provider_ref(Route),
PaymentRoute = hg_route:to_payment_route(Route),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Это не уникальный ключ. Ничего не мешает нам иметь несколько кандидатов одного и того же терминала.

Copy link
Copy Markdown
Contributor Author

@WWWcool WWWcool Apr 13, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

поменял подход - теперь тут сначала получаю уникальные ид для похода в ФД, потом иду, потом результаты запихиваю в оригинальный список роутов без мутации самого списка

Comment thread apps/routing/src/hg_route.erl Outdated
-spec from_payment_route(payment_route()) -> t().
from_payment_route(Route) ->
?route(ProviderRef, TerminalRef) = Route,
new(hg_domain:head(), ProviderRef, TerminalRef, 0, 1000, undefined).
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Воу воу. С чего мы вдруг берем hg_domain:head/0? Под рукой есть Revision платежа, не стоит сюда внедрять заведомо неверные данные (этого роута может даже уже не существовать в head).

Comment on lines -741 to -742
maybe_log_misconfigurations(_Error) ->
ok.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Таким образом он уже не maybe.

value = Token
},
DeadLine = woody_deadline:from_timeout(genlib_app:env(hellgate, inspect_timeout, infinity)),
{ok, Check} = issue_call(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я бы InvalidRequest ловил и игнорил тоже.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

там же issue_call ловит все {exception, Error} ->

Comment on lines -732 to -733
log_route_choice_meta(#{choice_meta := undefined}, _Revision) ->
ok;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Я так понял мы исключаем отсутствие этой меты?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

кажется что да, выглядело будто это артефакт переходного периода

[] ->
ok = log_rejected_route_groups(FilterResult, VS),
handle_filtered_routes_exhaustion(FilterResult, Revision, St, Action);
FilteredRoutes ->
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Тут пропускается log_rejected_route_groups/2. Раньше мы в любом случае получали это в логи.

Comment on lines +34 to +60
-spec get_route_payment_terms(hg_route:payment_route(), varset(), revision()) -> payment_terms() | undefined.
get_route_payment_terms(?route(ProviderRef, TerminalRef), VS, Revision) ->
PreparedVS = hg_varset:prepare_varset(VS),
{Client, Context} = get_party_client(),
{ok, TermsSet} = party_client_thrift:compute_provider_terminal_terms(
ProviderRef,
TerminalRef,
Revision,
PreparedVS,
Client,
Context
),
TermsSet#domain_ProvisionTermSet.payments.

-spec get_route_provision_terms(hg_route:payment_route(), varset(), revision()) -> provision_terms() | undefined.
get_route_provision_terms(?route(ProviderRef, TerminalRef), VS, Revision) ->
PreparedVS = hg_varset:prepare_varset(VS),
{Client, Context} = get_party_client(),
{ok, TermsSet} = party_client_thrift:compute_provider_terminal_terms(
ProviderRef,
TerminalRef,
Revision,
PreparedVS,
Client,
Context
),
TermsSet.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DRY. get_route_payment_terms может просто ходить в get_route_provision_terms

?payment_ev(PaymentID, ?shop_limit_initiated()),
?payment_ev(PaymentID, ?shop_limit_applied()),
?payment_ev(PaymentID, ?risk_score_changed(_RiskScore)),
?payment_ev(PaymentID, ?route_changed(_Route)),
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Как так получилось? Куда он делся?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

роутинг начал по другому работать - там теперь если у тебя после получения роутов пустой список то нет события с роутами, сразу идет фейл платежа

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants