mirror of
https://github.com/processone/ejabberd.git
synced 2024-11-22 16:20:52 +01:00
fixing pubsub_subscription issue when changed transaction to sync_dirty
SVN Revision: 2508
This commit is contained in:
parent
7c76c65c8c
commit
56e52f0571
@ -2952,8 +2952,10 @@ get_node_subs(#pubsub_node{type = Type,
|
|||||||
|
|
||||||
get_options_for_subs(_Host, Node, NodeID, Subs) ->
|
get_options_for_subs(_Host, Node, NodeID, Subs) ->
|
||||||
lists:foldl(fun({JID, subscribed, SubID}, Acc) ->
|
lists:foldl(fun({JID, subscribed, SubID}, Acc) ->
|
||||||
{result, #pubsub_subscription{options = Options}} = pubsub_subscription:get_subscription(JID, NodeID, SubID),
|
case pubsub_subscription:get_subscription(JID, NodeID, SubID) of
|
||||||
[{JID, Node, Options} | Acc];
|
{result, #pubsub_subscription{options = Options}} -> [{JID, Node, Options} | Acc];
|
||||||
|
_ -> Acc
|
||||||
|
end;
|
||||||
(_, Acc) ->
|
(_, Acc) ->
|
||||||
Acc
|
Acc
|
||||||
end, [], Subs).
|
end, [], Subs).
|
||||||
|
@ -92,31 +92,31 @@ init() ->
|
|||||||
ok = create_table().
|
ok = create_table().
|
||||||
|
|
||||||
subscribe_node(JID, NodeID, Options) ->
|
subscribe_node(JID, NodeID, Options) ->
|
||||||
case mnesia:sync_dirty(fun add_subscription/3,
|
case catch mnesia:sync_dirty(fun add_subscription/3,
|
||||||
[JID, NodeID, Options]) of
|
[JID, NodeID, Options]) of
|
||||||
{atomic, Result} -> {result, Result};
|
{'EXIT', {aborted, Error}} -> Error;
|
||||||
{aborted, Error} -> Error
|
Result -> {result, Result}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
unsubscribe_node(JID, NodeID, SubID) ->
|
unsubscribe_node(JID, NodeID, SubID) ->
|
||||||
case mnesia:sync_dirty(fun delete_subscription/3,
|
case catch mnesia:sync_dirty(fun delete_subscription/3,
|
||||||
[JID, NodeID, SubID]) of
|
[JID, NodeID, SubID]) of
|
||||||
{atomic, Result} -> {result, Result};
|
{'EXIT', {aborted, Error}} -> Error;
|
||||||
{aborted, Error} -> Error
|
Result -> {result, Result}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
get_subscription(JID, NodeID, SubID) ->
|
get_subscription(JID, NodeID, SubID) ->
|
||||||
case mnesia:sync_dirty(fun read_subscription/3,
|
case catch mnesia:sync_dirty(fun read_subscription/3,
|
||||||
[JID, NodeID, SubID]) of
|
[JID, NodeID, SubID]) of
|
||||||
{atomic, Result} -> {result, Result};
|
{'EXIT', {aborted, Error}} -> Error;
|
||||||
{aborted, Error} -> Error
|
Result -> {result, Result}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
set_subscription(JID, NodeID, SubID, Options) ->
|
set_subscription(JID, NodeID, SubID, Options) ->
|
||||||
case mnesia:sync_dirty(fun write_subscription/4,
|
case catch mnesia:sync_dirty(fun write_subscription/4,
|
||||||
[JID, NodeID, SubID, Options]) of
|
[JID, NodeID, SubID, Options]) of
|
||||||
{atomic, Result} -> {result, Result};
|
{'EXIT', {aborted, Error}} -> Error;
|
||||||
{aborted, Error} -> Error
|
Result -> {result, Result}
|
||||||
end.
|
end.
|
||||||
|
|
||||||
get_options_xform(Lang, Options) ->
|
get_options_xform(Lang, Options) ->
|
||||||
|
Loading…
Reference in New Issue
Block a user