plugin pubsub cache: new resync argument to force resynchronisation in synchronize
This commit is contained in:
parent
4e441258b3
commit
ab2f9661d1
1 changed files with 8 additions and 4 deletions
|
|
@ -707,16 +707,17 @@ class PubsubCache:
|
|||
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 @@ class PubsubCache:
|
|||
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)):
|
||||
|
|
|
|||
Loading…
Reference in a new issue