comparison sat/plugins/plugin_pubsub_cache.py @ 3619:32181a45d54b

plugin pubsub cache: use `asDeferred` with `match_cb`
author Goffi <goffi@goffi.org>
date Mon, 02 Aug 2021 21:52:17 +0200
parents 5d108ce026d7
children 342e3ddefd23
comparison
equal deleted inserted replaced
3618:7f503b20597e 3619:32181a45d54b
387 ) 387 )
388 else: 388 else:
389 analyse["conf"] = conf 389 analyse["conf"] = conf
390 390
391 for analyser in self.analysers.values(): 391 for analyser in self.analysers.values():
392 match_cb = analyser.get("match_cb")
393 try: 392 try:
394 an_node = analyser["node"] 393 an_node = analyser["node"]
395 except KeyError: 394 except KeyError:
396 pass 395 pass
397 else: 396 else:
427 try: 426 try:
428 match_cb = analyser["match_cb"] 427 match_cb = analyser["match_cb"]
429 except KeyError: 428 except KeyError:
430 pass 429 pass
431 else: 430 else:
432 await match_cb(client, analyse) 431 await utils.asDeferred(match_cb, client, analyse)
433 return analyse 432 return analyse
434 433
435 def _getItemsFromCache( 434 def _getItemsFromCache(
436 self, service="", node="", max_items=10, item_ids=None, sub_id=None, 435 self, service="", node="", max_items=10, item_ids=None, sub_id=None,
437 extra="", profile_key=C.PROF_KEY_NONE 436 extra="", profile_key=C.PROF_KEY_NONE