mirror of
https://github.com/processone/ejabberd.git
synced 2024-12-22 17:28:25 +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) ->
|
||||
lists:foldl(fun({JID, subscribed, SubID}, Acc) ->
|
||||
{result, #pubsub_subscription{options = Options}} = pubsub_subscription:get_subscription(JID, NodeID, SubID),
|
||||
[{JID, Node, Options} | Acc];
|
||||
case pubsub_subscription:get_subscription(JID, NodeID, SubID) of
|
||||
{result, #pubsub_subscription{options = Options}} -> [{JID, Node, Options} | Acc];
|
||||
_ -> Acc
|
||||
end;
|
||||
(_, Acc) ->
|
||||
Acc
|
||||
end, [], Subs).
|
||||
|
@ -92,31 +92,31 @@ init() ->
|
||||
ok = create_table().
|
||||
|
||||
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
|
||||
{atomic, Result} -> {result, Result};
|
||||
{aborted, Error} -> Error
|
||||
{'EXIT', {aborted, Error}} -> Error;
|
||||
Result -> {result, Result}
|
||||
end.
|
||||
|
||||
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
|
||||
{atomic, Result} -> {result, Result};
|
||||
{aborted, Error} -> Error
|
||||
{'EXIT', {aborted, Error}} -> Error;
|
||||
Result -> {result, Result}
|
||||
end.
|
||||
|
||||
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
|
||||
{atomic, Result} -> {result, Result};
|
||||
{aborted, Error} -> Error
|
||||
{'EXIT', {aborted, Error}} -> Error;
|
||||
Result -> {result, Result}
|
||||
end.
|
||||
|
||||
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
|
||||
{atomic, Result} -> {result, Result};
|
||||
{aborted, Error} -> Error
|
||||
{'EXIT', {aborted, Error}} -> Error;
|
||||
Result -> {result, Result}
|
||||
end.
|
||||
|
||||
get_options_xform(Lang, Options) ->
|
||||
|
Loading…
Reference in New Issue
Block a user