Skip to content

Commit

Permalink
Fail if mam fails
Browse files Browse the repository at this point in the history
  • Loading branch information
NelsonVides committed Sep 24, 2022
1 parent d5bc12b commit 9ce54b3
Showing 1 changed file with 11 additions and 8 deletions.
19 changes: 11 additions & 8 deletions src/mam/mod_mam_rdbms_arch.erl
Original file line number Diff line number Diff line change
Expand Up @@ -341,15 +341,18 @@ remove_archive(Acc, HostType, ArcID, _ArcJID) ->
mongoose_rdbms:execute_successfully(HostType, mam_archive_remove, [ArcID]),
Acc.

-spec remove_domain(mongoose_hooks:simple_acc(), host_type(), jid:lserver()) ->
mongoose_hooks:simple_acc().
-spec remove_domain(mongoose_domain_api:remove_domain_acc(), host_type(), jid:lserver()) ->
mongoose_domain_api:remove_domain_acc().
remove_domain(Acc, HostType, Domain) ->
{atomic, _} = mongoose_rdbms:sql_transaction(HostType, fun() ->
mongoose_rdbms:execute_successfully(HostType, mam_remove_domain, [Domain]),
mongoose_rdbms:execute_successfully(HostType, mam_remove_domain_prefs, [Domain]),
mongoose_rdbms:execute_successfully(HostType, mam_remove_domain_users, [Domain])
end),
Acc.
F = fun() ->
{atomic, _} = mongoose_rdbms:sql_transaction(HostType, fun() ->
mongoose_rdbms:execute_successfully(HostType, mam_remove_domain, [Domain]),
mongoose_rdbms:execute_successfully(HostType, mam_remove_domain_prefs, [Domain]),
mongoose_rdbms:execute_successfully(HostType, mam_remove_domain_users, [Domain])
end),
Acc
end,
mongoose_domain_api:remove_domain_wrapper(Acc, F, ?MODULE).

%% GDPR logic
extract_gdpr_messages(Env, ArcID) ->
Expand Down

0 comments on commit 9ce54b3

Please sign in to comment.