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 | f8505ab244e435680779369378080a65ede3718b (patch) | |
tree | 3572e49bfed5e99ae69b5b578a3ecab80700956e /util/pubsub.lua | |
parent | 96abbc6f62b29638b60b55d47f185a0b6ab23230 (diff) | |
download | prosody-f8505ab244e435680779369378080a65ede3718b.tar.gz prosody-f8505ab244e435680779369378080a65ede3718b.zip |
util.pubsub: Clear data store if it supports being cleared, otherwise fall back to creating a new one
Diffstat (limited to 'util/pubsub.lua')
-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); |