Should we be reusing Client objects? #1962
Unanswered
tyteen4a03
asked this question in
Q&A
Replies: 1 comment 2 replies
-
That's fine yup. A singleton or a globally available I can't really give you any guidance on the request body question without a specific example to work against, but worth noting that if you're uploading large requests you might want to stream them, rather than loading them into memory. Yes they'll stick around until the response is gc'ed. |
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In following to this question on SO:
Similar to the question asked here, we are seeing memory leaks in our HTTP client wrapper. We have a singleton that reuses an
httpx.Client()and return theResponseobject back to the caller of our singleton. Our current suspicion is theClientnot cleaning up properly.Is this the correct pattern? How should we prevent this leak while making sure the entire
Responseobject is still available to the downstream callers of our singleton?Beta Was this translation helpful? Give feedback.
All reactions