Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.Sign up
Add client and server timeouts to rpc #652
This is an implementation of the suggested feature mentioned here: https://www.notion.so/Full-support-for-RPC-timeouts-592cd7903cc84a049be11abfe778d5ce
There are still some additional tests missing but the basic concept would be to add to arguments to all rpc clients (standalone and dependency provider):
I built in logic to try and prevent race conditions (message removed from server and client is still waiting forever for an answer).
As always there are a few open questions I'd like to discuss with the maintainers (@mattbennett ?):
The current implementation no longer uses the socket timeout on the standalone rpc client (as suggested in the roadmap). However, it now relies on the timeout being raised by the rpc client. Previously (as far as I can tell) the standalone client did not rely on eventlet at all, but now the rpc client uses this to implement timing out after waiting for a reply for a while. The question is whether this is ok, or if this was a conscious decision to allow non-monkeypatched clients to still use the standalone rpc client.
mattbennett left a comment
This looks great, thanks @daviskirk!
It was a conscious choice, but not a very well executed one. The idea is to be able to use the
For now though people rely on it working without a monkey patch. Can you implement a native-thread based timeout mechanism? Then it'd work in vanilla Python and Eventlet can co-opt it if the monkey patch is applied.
I used the builtin "timeout" argument in the consumer and added a test