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 inner transport not closed #147

Merged
merged 3 commits into from
Dec 29, 2023
Merged

Fix inner transport not closed #147

merged 3 commits into from
Dec 29, 2023

Conversation

yanyongyu
Copy link
Contributor

@yanyongyu yanyongyu commented Dec 29, 2023

The inner transport will be closed automatically when closing outer transport.
But, CacheConnectionPool wraps the pool of type RequestInterface, which do not have close method. I'm not sure how to fix the closing of pool.

fix #145

Copy link

codecov bot commented Dec 29, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (cab9520) 100.00% compared to head (da33642) 100.00%.

Additional details and impacted files
@@            Coverage Diff            @@
##            master      #147   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           29        29           
  Lines         2063      2064    +1     
=========================================
+ Hits          2063      2064    +1     

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

@karpetrosyan
Copy link
Owner

Looks great, thanks! For AsyncCacheConnectionPool and CacheConnectionPool, I'd recommend something like this:

    async def aclose(self) -> None:
        await self._storage.aclose()

        if hasattr(self._pool, "aclose"):  # pragma: no cover
            await self._pool.aclose()

This is what we use in httpcore for such cases.

@yanyongyu
Copy link
Contributor Author

Updated. added close to cachepool

@karpetrosyan karpetrosyan merged commit 6e58129 into karpetrosyan:master Dec 29, 2023
6 checks passed
@yanyongyu yanyongyu deleted the fix/transport-close branch December 29, 2023 08:55
@karpetrosyan karpetrosyan mentioned this pull request Dec 29, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Transport socket unclosed
2 participants