Mercurial > libervia-backend
changeset 3760:74f436e856ff
plugin pubsub cache: new `resync` argument to force resynchronisation in `synchronize`
author | Goffi <goffi@goffi.org> |
---|---|
date | Fri, 13 May 2022 18:44:54 +0200 |
parents | c4881833cf8a |
children | e0ff2f277e13 |
files | sat/plugins/plugin_pubsub_cache.py |
diffstat | 1 files changed, 8 insertions(+), 4 deletions(-) [+] |
line wrap: on
line diff
--- a/sat/plugins/plugin_pubsub_cache.py Fri May 13 18:43:42 2022 +0200 +++ b/sat/plugins/plugin_pubsub_cache.py Fri May 13 18:44:54 2022 +0200 @@ -707,16 +707,17 @@ self, client: SatXMPPEntity, service: jid.JID, - node: str + node: str, + resync: bool = True ) -> None: """Synchronise a node with a pubsub service - If the node is already synchronised, it will be resynchronised (all items will be - deleted and re-downloaded). - The node will be synchronised even if there is no matching analyser. Note that when a node is synchronised, it is automatically subscribed. + @param resync: if True and the node is already synchronised, it will be + resynchronised (all items will be deleted and re-downloaded). + """ pubsub_node = await self.host.memory.storage.getPubsubNode( client, service, node @@ -735,6 +736,9 @@ analyser=analyse.get("name"), type_=analyse.get("type"), ) + elif not resync: + # the node exists, nothing to do + return if ((pubsub_node.sync_state == SyncState.IN_PROGRESS or (service, node) in self.in_progress)):