aio-libs / aiodocker

Python Docker API client based on asyncio and aiohttp
Other
427 stars 97 forks source link

Fix never awaited coroutines to close #861

Closed fregataa closed 2 months ago

fregataa commented 3 months ago

What do these changes do?

utils._AsyncCM objects have a _coro coroutine type field. In some cases, it is not awaited and it raises RuntimeWarning like below

RuntimeWarning: coroutine 'Docker._do_query' was never awaited

One of the suspicious parts is from Container.log(). Let's close the coroutine if any error occurs.

Are there changes in behavior for the user?

They will not see RuntimeWarning anymore!

Related issue number

Checklist

codecov[bot] commented 3 months ago

Codecov Report

Attention: Patch coverage is 75.00000% with 3 lines in your changes missing coverage. Please review.

Project coverage is 81.25%. Comparing base (906d8c5) to head (f7a9476).

:exclamation: Current head f7a9476 differs from pull request most recent head 4e85c33

Please upload reports for the commit 4e85c33 to get more accurate results.

Files Patch % Lines
aiodocker/containers.py 70.00% 3 Missing :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #861 +/- ## ========================================== - Coverage 81.34% 81.25% -0.09% ========================================== Files 24 24 Lines 1372 1382 +10 Branches 245 245 ========================================== + Hits 1116 1123 +7 - Misses 170 173 +3 Partials 86 86 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.