dapper91 / pjrpc

python json-rpc client/server without boilerplate
https://pjrpc.readthedocs.io
The Unlicense
32 stars 3 forks source link

Fix AssertionErrors in close() of aio_pika client. #92

Closed bernhardkaindl closed 1 year ago

bernhardkaindl commented 2 years ago

Issue #91 shows an AssertionError when a connected aio_pika client which didn't need to open a result queue calls client.close().

It should be possible to call client.close() also in this case to close the connection to the RabbitMQ server, because when either the client was interrupted, had nothing to do before closing, it, this is the normal state.

Also replace the other assertions in the aio_pika client's close() with simple checks which don't abort the function to close any other remaining connection elements or futures which are not properly handled when simply aborting with an assertion.

For details and a test case, see issue #91.

codecov-commenter commented 2 years ago

Codecov Report

Merging #92 (415416d) into dev (064c5c6) will decrease coverage by 0.05%. The diff coverage is 93.75%.

@@            Coverage Diff             @@
##              dev      #92      +/-   ##
==========================================
- Coverage   79.49%   79.44%   -0.06%     
==========================================
  Files          41       40       -1     
  Lines        2717     2715       -2     
==========================================
- Hits         2160     2157       -3     
- Misses        557      558       +1     
Flag Coverage Δ
unittests 79.44% <93.75%> (-0.06%) :arrow_down:

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
pjrpc/client/backend/aio_pika.py 0.00% <0.00%> (ø)
pjrpc/client/backend/kombu.py 0.00% <0.00%> (ø)
pjrpc/__about__.py 100.00% <100.00%> (ø)
pjrpc/client/client.py 97.55% <100.00%> (ø)
pjrpc/client/integrations/pytest.py 91.85% <100.00%> (ø)
pjrpc/common/__init__.py 91.66% <100.00%> (ø)
pjrpc/common/common.py 85.71% <100.00%> (-2.75%) :arrow_down:
pjrpc/common/exceptions.py 98.64% <100.00%> (ø)
pjrpc/common/v20.py 91.22% <100.00%> (ø)
pjrpc/server/dispatcher.py 87.73% <100.00%> (+0.04%) :arrow_up:
... and 7 more

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

bernhardkaindl commented 2 years ago

@dapper91 ping