mirror of
https://github.com/avatao-content/baseimage-tutorial-framework
synced 2024-11-05 14:41:20 +00:00
Use meaningful names in EventHandler
This commit is contained in:
parent
6a5b83f406
commit
f995aae318
@ -9,11 +9,11 @@ class EventHandler(EventHandlerBase):
|
||||
super().__init__(anchor, zmq_context)
|
||||
self.event_handler_function = event_handler_function
|
||||
|
||||
def wrapper(msg_parts, handler):
|
||||
def event_handler_callback(msg_parts, handler_func):
|
||||
anchor, message = msg_parts
|
||||
data_json = json.loads(message)
|
||||
response = handler(data_json, self)
|
||||
response = handler_func(data_json, self)
|
||||
encoded_response = json.dumps(response).encode('utf-8')
|
||||
self.zmq_push_socket.send_multipart([anchor, encoded_response])
|
||||
|
||||
self.zmq_sub_stream.on_recv(partial(wrapper, handler=event_handler_function))
|
||||
self.zmq_sub_stream.on_recv(partial(event_handler_callback, handler_func=event_handler_function))
|
||||
|
Loading…
Reference in New Issue
Block a user