[Entities UI] Better refresh logic.

This commit is contained in:
Fabio Manganiello 2023-12-29 03:45:17 +01:00
parent 6673bb4c19
commit 171ed7f743
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774
2 changed files with 4 additions and 9 deletions

View file

@ -426,14 +426,9 @@ export default {
'platypush.message.event.entities.EntityDeleteEvent' 'platypush.message.event.entities.EntityDeleteEvent'
) )
if (!this.loadCachedEntities()) { const hasCachedEntities = this.loadCachedEntities()
await this.sync() await this.sync(!hasCachedEntities)
this.refresh() await this.refresh()
} else {
await this.request('entities.scan')
this.sync()
}
setInterval(() => this.refreshEntitiesCache(), 10000) setInterval(() => this.refreshEntitiesCache(), 10000)
}, },

View file

@ -278,7 +278,7 @@ class AssistantPlugin(Plugin, AssistantEntityManager, ABC):
else: else:
self._on_unmute() self._on_unmute()
def transform_entities(self, entities: Collection['AssistantPlugin']): def transform_entities(self, entities: Collection['AssistantPlugin'], **_):
return super().transform_entities( return super().transform_entities(
[ [
Assistant( Assistant(