From 2cd930b7d5fc549282974fbf05cf5d65a4a38edb Mon Sep 17 00:00:00 2001 From: Evgeny Khramtsov Date: Mon, 29 Jul 2019 21:44:30 +0300 Subject: [PATCH] Appropriately abort pubsub transaction --- src/mod_pubsub.erl | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/mod_pubsub.erl b/src/mod_pubsub.erl index 8dbe9cb98..464668874 100644 --- a/src/mod_pubsub.erl +++ b/src/mod_pubsub.erl @@ -3806,9 +3806,15 @@ transaction(Host, Fun, Trans) -> do_transaction(ServerHost, Fun, Trans, DBType) -> F = fun() -> try Fun() - catch ?EX_RULE(Class, Reason, St) -> + catch ?EX_RULE(Class, Reason, St) when (DBType == mnesia andalso + Trans == transaction) orelse + DBType == sql -> StackTrace = ?EX_STACK(St), - mnesia:abort({exception, Class, Reason, StackTrace}) + Ex = {exception, Class, Reason, StackTrace}, + case DBType of + mnesia -> mnesia:abort(Ex); + sql -> ejabberd_sql:abort(Ex) + end end end, Res = case DBType of