Skip to content

ED-305: withdrawal repair tools - #411

Open
georgemadskillz wants to merge 20 commits into
masterfrom
ED-305/ft/repair_tools
Open

ED-305: withdrawal repair tools#411
georgemadskillz wants to merge 20 commits into
masterfrom
ED-305/ft/repair_tools

Conversation

@georgemadskillz

Copy link
Copy Markdown
Contributor

No description provided.

@keynslug keynslug left a comment

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.

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

Comment thread apps/ff_cth/src/ct_domain_config.erl Outdated

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

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.

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

Comment thread apps/ff_transfer/src/ff_withdrawal.erl Outdated
Comment on lines +465 to +476
]
],
Result

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.

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

Comment thread apps/ff_transfer/src/ff_withdrawal.erl Outdated

-spec process_repair(repair_scenario(), withdrawal_state()) -> process_result().
process_repair({routing, {route_changed, Route}}, _Withdrawal) ->
{{set_timer, 0}, [{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.

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

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.

Comment thread apps/ff_transfer/src/ff_withdrawal.erl Outdated
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
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.

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

Comment thread apps/ff_transfer/src/ff_withdrawal.erl Outdated
Comment on lines +1773 to +1774
build_failure({route_not_found, Reason}, _Withdrawal) ->
#{code => Reason};

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.

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

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.

Задумка была в том, что тот кто запустит восстановление по сценарию 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
Copy Markdown
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
Copy Markdown
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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

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

-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
Copy Markdown
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.

-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
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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

{invalid_withdrawal_status, status()}.

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

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.

Тогда это изменение тоже можно убрать.

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