# HG changeset patch # User Goffi # Date 1652460294 -7200 # Node ID 74f436e856ff5ec87f72dafcd9429630f64b9617 # Parent c4881833cf8ab6a58edb29c5c5c4dbb6a7d42357 plugin pubsub cache: new `resync` argument to force resynchronisation in `synchronize` diff -r c4881833cf8a -r 74f436e856ff sat/plugins/plugin_pubsub_cache.py --- 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)):