diff options
author | Kim Alvefur <zash@zash.se> | 2017-10-08 01:27:04 +0200 |
---|---|---|
committer | Kim Alvefur <zash@zash.se> | 2017-10-08 01:27:04 +0200 |
commit | 2d6ea5d99d8da18bd3132f50625ca9b889a9c489 (patch) | |
tree | 3572e49bfed5e99ae69b5b578a3ecab80700956e /util | |
parent | 30ac4f0bef3476ebace0ec4c5f4c3b54393c746c (diff) | |
download | prosody-2d6ea5d99d8da18bd3132f50625ca9b889a9c489.tar.gz prosody-2d6ea5d99d8da18bd3132f50625ca9b889a9c489.zip |
util.pubsub: Clear data store if it supports being cleared, otherwise fall back to creating a new one
Diffstat (limited to 'util')
-rw-r--r-- | util/pubsub.lua | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/util/pubsub.lua b/util/pubsub.lua index 014aaa86..6dbbad20 100644 --- a/util/pubsub.lua +++ b/util/pubsub.lua @@ -312,7 +312,11 @@ function service:purge(node, actor, notify) 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); |