comparison util/pubsub.lua @ 14188:dbbafef0748f

util.pubsub: Recreate intermediate tables if necessary when restoring old subscription state
author Matthew Wild <mwild1@gmail.com>
date Mon, 25 May 2026 21:14:24 +0100
parents 4f12f98c2ec1
children
comparison
equal deleted inserted replaced
14187:4f12f98c2ec1 14188:dbbafef0748f
541 local ok, err = save_node_to_store(self, node_obj); -- luacheck: ignore 211/err 541 local ok, err = save_node_to_store(self, node_obj); -- luacheck: ignore 211/err
542 if not ok then 542 if not ok then
543 -- Restore previous in-memory state 543 -- Restore previous in-memory state
544 node_obj.subscribers[jid] = old_subscription; 544 node_obj.subscribers[jid] = old_subscription;
545 node_obj.pending_subscribers[jid] = pending_subscription; 545 node_obj.pending_subscribers[jid] = pending_subscription;
546 if not self.subscriptions[normal_jid] then
547 self.subscriptions[normal_jid] = {};
548 end
549 if not self.subscriptions[normal_jid][jid] then
550 self.subscriptions[normal_jid][jid] = {};
551 end
546 if pending_subscription then 552 if pending_subscription then
547 self.subscriptions[normal_jid][jid][node] = false; 553 self.subscriptions[normal_jid][jid][node] = false;
548 elseif old_subscription then 554 elseif old_subscription then
549 self.subscriptions[normal_jid][jid][node] = true; 555 self.subscriptions[normal_jid][jid][node] = true;
550 end 556 end