athenad: explicitly delete socket in getMessage (#34098)

explicitly delete socket in getMessage
pull/34118/head
Dean Lee 5 months ago committed by GitHub
parent 8f71d53eb0
commit b737e8472f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 13
      system/athena/athenad.py

@ -309,13 +309,16 @@ def getMessage(service: str, timeout: int = 1000) -> dict:
raise Exception("invalid service") raise Exception("invalid service")
socket = messaging.sub_sock(service, timeout=timeout) socket = messaging.sub_sock(service, timeout=timeout)
ret = messaging.recv_one(socket) try:
ret = messaging.recv_one(socket)
if ret is None: if ret is None:
raise TimeoutError raise TimeoutError
# this is because capnp._DynamicStructReader doesn't have typing information # this is because capnp._DynamicStructReader doesn't have typing information
return cast(dict, ret.to_dict()) return cast(dict, ret.to_dict())
finally:
del socket
@dispatcher.add_method @dispatcher.add_method

Loading…
Cancel
Save