Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ED-305: withdrawal repair tools #411

Open
wants to merge 20 commits into
base: master
Choose a base branch
from

Conversation

georgemadskillz
Copy link
Contributor

No description provided.

Copy link
Contributor

@keynslug keynslug left a comment

Choose a reason for hiding this comment

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

Тесты не смотрел ещё, сорямба.

@@ -31,6 +34,11 @@ all(Revision) ->
#'Snapshot'{domain = Domain} = dmt_client:checkout(Revision),
Domain.

-spec checkout_object(revision(), object_ref()) -> object() | no_return().
checkout_object(Revision, ObjectRef) ->
#'Snapshot'{domain = Domain} = dmt_client:checkout(Revision),
Copy link
Contributor

Choose a reason for hiding this comment

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

В dmt_client теперь же есть оптимальный checkout_object.

Comment on lines 465 to 476
]
],
Result
Copy link
Contributor

Choose a reason for hiding this comment

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

Какое-то немного бессмысленное изменение, не?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Плохо почистил всё после того как вставлял printf'ы, еще приберусь.

@@ -761,6 +795,12 @@ do_process_transfer(adjustment, Withdrawal) ->
do_process_transfer(stop, _Withdrawal) ->
{undefined, []}.

-spec process_repair(repair_scenario(), withdrawal_state()) -> process_result().
process_repair({routing, {route_changed, Route}}, _Withdrawal) ->
{{set_timer, 0}, [{route_changed, Route}]};
Copy link
Contributor

Choose a reason for hiding this comment

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

А зачем новый action? Чем это от continue отличается?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Comment on lines 762 to 764
-spec do_process_repair(repair_scenario(), withdrawal_state()) -> process_result().
do_process_repair(Scenario, Withdrawal) ->
process_repair(Scenario, Withdrawal).
Copy link
Contributor

Choose a reason for hiding this comment

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

Нахожу эту функцию немного бессмысленной. 🤔 Зачем она тут?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Это небольшой артефакт, который остался после того как я пробовал разные варианты запуска сценария починки. Сначала я эту функцию завел для единообразия с do_process_transfer, а потом оказалось что здесь делать нечего, но пока я это оставил. Выпилю, если она пустой останется.

Comment on lines 1773 to 1774
build_failure({route_not_found, Reason}, _Withdrawal) ->
#{code => Reason};
Copy link
Contributor

Choose a reason for hiding this comment

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

Вообще выглядит немного странно: сценарий называется route_not_found, но при этом withdrawal просто завершится с произвольной ошибкой. Причём тут тогда route_not_found? 🤔

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Задумка была в том, что тот кто запустит восстановление по сценарию route_not_found напишет Reason, и это можно будет легко найти в логах, либо спустя время вспомнить что это был не просто "no_route_found", а что-то типа "Hand repair with no_route_found". Я упустил, что в этом случае в Reason'е может не оказаться слов про no_route_found (по умолчанию если инициатор поленится указать Reason, то будет дефолтное <<"no_route_found">>).

Тут два варианта, либо вообще Reason выпилить, либо вместо #{code => Reason} делать что-то типа #{code => <<"no_route_found, reason: ", Reason">>}. Вопрос в полезности этой фичи. Как считаешь?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

(подозреваю, что поле 'code' задумывалось как нехудожественное короткое обозначение ошибки, и значит не надо там писать никаких ризонов, короче наверное надо просто выпилить Reason и всё)

Copy link
Contributor

Choose a reason for hiding this comment

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

Тут два варианта, либо вообще Reason выпилить, либо вместо #{code => Reason} делать что-то типа #{code => <<"no_route_found, reason: ", Reason">>}. Вопрос в полезности этой фичи. Как считаешь?

Я думаю, что для такого сценарий должен по-другому называться, типа MakeFailed.

Copy link
Contributor

Choose a reason for hiding this comment

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

надо просто выпилить Reason и всё)

Для текущего сценария определённо.

@@ -188,8 +188,18 @@ process_call(CallArgs, _Machine, _, _Opts) ->

-spec process_repair(ff_repair:scenario(), machine(), handler_args(), handler_opts()) ->
{ok, {repair_response(), result()}} | {error, repair_error()}.
process_repair({add_events, _} = Scenario, Machine, _Args, _Opts) ->
ff_repair:apply_scenario(ff_withdrawal, Machine, Scenario);
Copy link
Contributor

Choose a reason for hiding this comment

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

Кажется по задумке автора ff_repair ты просто процессор должен был добавить для этого сценария и передать его в ff_repair:apply_scenario/4.

@@ -7,6 +7,8 @@
-include_lib("damsel/include/dmsl_payment_processing_thrift.hrl").
-include_lib("damsel/include/dmsl_withdrawals_provider_adapter_thrift.hrl").

-include_lib("fistful_proto/include/ff_proto_withdrawal_thrift.hrl").
Copy link
Contributor

Choose a reason for hiding this comment

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

А зачем тут новый include? Чё-то не вижу сходу потребности.(как кстати и в предыдущем include)

@@ -170,7 +173,7 @@
-type invalid_withdrawal_status_error() ::
{invalid_withdrawal_status, status()}.

-type action() :: sleep | continue | undefined.
-type action() :: sleep | continue | undefined | {set_timer, integer()}.
Copy link
Contributor

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