aboutsummaryrefslogtreecommitdiff
path: root/src/node_flat.erl
diff options
context:
space:
mode:
authorChristophe Romain <christophe.romain@process-one.net>2017-02-23 16:43:22 +0100
committerChristophe Romain <christophe.romain@process-one.net>2017-02-23 16:43:22 +0100
commit720741b7255a24997f7952bbb5d2f302bbd453ed (patch)
tree64e73d9d1d92473fc8fa2fef5e41313f6e379ef7 /src/node_flat.erl
parentFix pubsub MySQL schema (diff)
Avoid orphan_item leak on affiliation/subscription removal (#1563)
Diffstat (limited to 'src/node_flat.erl')
-rw-r--r--src/node_flat.erl8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/node_flat.erl b/src/node_flat.erl
index 1809915ff..907858428 100644
--- a/src/node_flat.erl
+++ b/src/node_flat.erl
@@ -707,7 +707,13 @@ del_state(#pubsub_state{stateid = {Key, Nidx}, items = Items}) ->
[] ->
ok;
_ ->
- Orphan = #pubsub_orphan{nodeid = Nidx, items = Items},
+ Orphan = #pubsub_orphan{nodeid = Nidx, items =
+ case mnesia:read({pubsub_orphan, Nidx}) of
+ [#pubsub_orphan{items = ItemIds}] ->
+ lists:usort(ItemIds++Items);
+ _ ->
+ Items
+ end},
mnesia:write(Orphan)
end,
mnesia:delete({pubsub_state, {Key, Nidx}}).