Mercurial > libervia-backend
comparison sat/plugins/plugin_pubsub_cache.py @ 3831:604b6acaee22
plugin pubsub cache: resync in `synchronise` when node's `sync_state` is not set:
synchronisation used to be skipped when the node was existing and `resync` was not set,
however the case happens when a node is subscribed but not synchronised, thus this patch
update the behaviour to be sure to have the node synchronised.
rel 369
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 10 Jul 2022 15:16:15 +0200 |
parents | 74f436e856ff |
children | 8a2c46122a11 |
comparison
equal
deleted
inserted
replaced
3830:68a11b95a7d3 | 3831:604b6acaee22 |
---|---|
562 else: | 562 else: |
563 log.warning( | 563 log.warning( |
564 f"Unexpected Pubsub event element: {xml_tools.pFmtElt(elt)}" | 564 f"Unexpected Pubsub event element: {xml_tools.pFmtElt(elt)}" |
565 ) | 565 ) |
566 if items: | 566 if items: |
567 log.debug("caching new items received from {node}") | 567 log.debug(f"[{client.profile}] caching new items received from {node}") |
568 await self.cacheItems( | 568 await self.cacheItems( |
569 client, node, items | 569 client, node, items |
570 ) | 570 ) |
571 if retract_ids: | 571 if retract_ids: |
572 log.debug(f"deleting retracted items from {node}") | 572 log.debug(f"deleting retracted items from {node}") |
734 service, | 734 service, |
735 node, | 735 node, |
736 analyser=analyse.get("name"), | 736 analyser=analyse.get("name"), |
737 type_=analyse.get("type"), | 737 type_=analyse.get("type"), |
738 ) | 738 ) |
739 elif not resync: | 739 elif not resync and pubsub_node.sync_state is not None: |
740 # the node exists, nothing to do | 740 # the node exists, nothing to do |
741 return | 741 return |
742 | 742 |
743 if ((pubsub_node.sync_state == SyncState.IN_PROGRESS | 743 if ((pubsub_node.sync_state == SyncState.IN_PROGRESS |
744 or (service, node) in self.in_progress)): | 744 or (service, node) in self.in_progress)): |