diff options
author | Christophe Romain <christophe.romain@process-one.net> | 2017-02-23 16:43:22 +0100 |
---|---|---|
committer | Christophe Romain <christophe.romain@process-one.net> | 2017-02-23 16:43:22 +0100 |
commit | 720741b7255a24997f7952bbb5d2f302bbd453ed (patch) | |
tree | 64e73d9d1d92473fc8fa2fef5e41313f6e379ef7 /src/node_flat.erl | |
parent | Fix 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.erl | 8 |
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}}). |