Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix never awaited coroutines to close #861

Merged
merged 7 commits into from
Jun 11, 2024

Conversation

fregataa
Copy link
Contributor

@fregataa fregataa commented Jun 2, 2024

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

  • I think the code is well written
  • Unit tests for the changes exist
  • Documentation reflects the changes
  • If you provide code modification, please add yourself to CONTRIBUTORS.txt
    • The format is <Name> <Surname>.
    • Please keep alphabetical order, the file is sorted by names.
  • Add a new news fragment into the changes folder
    • name it <issue_id>.<type> for example (588.bug)
    • if you don't have an issue_id change it to the pr id after creating the pr
    • ensure type is one of the following:
      • .feature: Signifying a new feature.
      • .bugfix: Signifying a bug fix.
      • .doc: Signifying a documentation improvement.
      • .removal: Signifying a deprecation or removal of public API.
      • .misc: A ticket has been closed, but it is not of interest to users.
    • Make sure to use full sentences with correct case and punctuation, for example: "Fix issue with non-ascii contents in doctest text files."

@fregataa fregataa changed the title Fix never awaited coroutine in Container.log() Fix never awaited coroutine Jun 2, 2024
@fregataa fregataa changed the title Fix never awaited coroutine Fix never awaited coroutines to close Jun 2, 2024
Copy link

codecov bot commented Jun 2, 2024

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).

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 ⚠️
Additional details and impacted files
@@            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              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@achimnol achimnol added the bug label Jun 2, 2024
@achimnol achimnol merged commit 7b3d86f into aio-libs:master Jun 11, 2024
10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants