Closed maksimdrachov closed 1 year ago
The code looks correct to me, at least I don't see any obvious issues. Which transport are you using and what is the node-ID of Yakut? You should inspect verbose logs from both Yakut and your application. There will be a lot of output but in that output there will be useful information regarding the lost transfer. At least you'll know if the response is actually being sent.
Ok, it was this:
@staticmethod
async def _serve_request_vote(
# self,
request: sirius_cyber_corp.RequestVote_1.Request,
metadata: pycyphal.presentation.ServiceRequestMetadata,
) -> sirius_cyber_corp.RequestVote_1.Response:
_logger.info(
"\033[94m Request vote request %s from node %d \033[0m",
request,
metadata.client_node_id,
)
return sirius_cyber_corp.RequestVote_1.Response(
term=1,
voteGranted=True, # <---- previously wrong argument name here
)
Shows up in the log as follows:
I'm trying to get a response from
request_vote
, after sending a request using Yakut.The issue is that I'm not getting any response, and the request times out:
The demo node does appear to receive the request correctly:
(When running in debug mode, putting a breakpoint on the entrance of
_serve_request_vote
, it appears to hang on the return statement)The code implementing this
request_vote
functionality is as follows:Add
srv_request_vote
to be served in the background:The
_serve_request_vote
function itself:This is pretty much the same way it is done in the demo example from pycyphal.
The only thing I'm unclear about is whether it might have something to do the way
run()
is implemented:In the demo example, there's more setup code here, however nothing related to the service (
least_square
in their case.)I suspect maybe I need to use the library in "IoC-style by using receive_in_background()", however not sure how this looks in code, please bear with me and use simple words.