Software /
code /
prosody
Changeset
8297:ac5c90230c2c
util.pubsub: Clear data store if it supports being cleared, otherwise fall back to creating a new one
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sun, 08 Oct 2017 01:27:04 +0200 |
parents | 8296:e23328adca25 |
children | 8298:dd9fa511494a |
files | util/pubsub.lua |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- 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);