feat: improve callback performance (#16)
This commit is contained in:
@@ -332,7 +332,7 @@ class MessageBus(BaseMessageBus):
|
|||||||
else:
|
else:
|
||||||
_future_set_result(future, reply)
|
_future_set_result(future, reply)
|
||||||
|
|
||||||
self._call(msg, reply_handler)
|
self._call(msg, reply_handler, check_callback=False)
|
||||||
|
|
||||||
await future
|
await future
|
||||||
|
|
||||||
|
|||||||
@@ -634,8 +634,9 @@ class BaseMessageBus:
|
|||||||
if err:
|
if err:
|
||||||
raise err
|
raise err
|
||||||
|
|
||||||
def _call(self, msg, callback):
|
def _call(self, msg, callback, check_callback: bool = True) -> None:
|
||||||
BaseMessageBus._check_callback_type(callback)
|
if check_callback:
|
||||||
|
BaseMessageBus._check_callback_type(callback)
|
||||||
|
|
||||||
if not msg.serial:
|
if not msg.serial:
|
||||||
msg.serial = self.next_serial()
|
msg.serial = self.next_serial()
|
||||||
@@ -887,6 +888,7 @@ class BaseMessageBus:
|
|||||||
member="GetMachineId",
|
member="GetMachineId",
|
||||||
),
|
),
|
||||||
reply_handler,
|
reply_handler,
|
||||||
|
check_callback=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _default_get_managed_objects_handler(self, msg, send_reply):
|
def _default_get_managed_objects_handler(self, msg, send_reply):
|
||||||
@@ -1109,6 +1111,7 @@ class BaseMessageBus:
|
|||||||
body=[self._name_owner_match_rule],
|
body=[self._name_owner_match_rule],
|
||||||
),
|
),
|
||||||
add_match_notify,
|
add_match_notify,
|
||||||
|
check_callback=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _add_match_rule(self, match_rule):
|
def _add_match_rule(self, match_rule):
|
||||||
@@ -1142,6 +1145,7 @@ class BaseMessageBus:
|
|||||||
body=[match_rule],
|
body=[match_rule],
|
||||||
),
|
),
|
||||||
add_match_notify,
|
add_match_notify,
|
||||||
|
check_callback=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
def _remove_match_rule(self, match_rule):
|
def _remove_match_rule(self, match_rule):
|
||||||
@@ -1180,4 +1184,5 @@ class BaseMessageBus:
|
|||||||
body=[match_rule],
|
body=[match_rule],
|
||||||
),
|
),
|
||||||
remove_match_notify,
|
remove_match_notify,
|
||||||
|
check_callback=False,
|
||||||
)
|
)
|
||||||
|
|||||||
Reference in New Issue
Block a user