util.pubsub: Clear data store if it supports being cleared, otherwise fall back to creating a new one
--- a/util/pubsub.lua Sun Oct 08 01:23:43 2017 +0200
+++ b/util/pubsub.lua Sun Oct 08 01:27:04 2017 +0200
@@ -312,7 +312,11 @@
if not node_obj then
return false, "item-not-found";
end
- self.data[node] = self.config.itemstore(self.nodes[node].config, node);
+ if self.data[node] and self.data[node].clear then
+ self.data[node]:clear()
+ else
+ self.data[node] = self.config.itemstore(self.nodes[node].config, node);
+ end
self.events.fire_event("node-purged", { node = node, actor = actor });
if notify then
self.config.broadcaster("purge", node, node_obj.subscribers);