Fix closing after a failed logout and changing base_url - #166
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #166 +/- ##
==========================================
+ Coverage 96.33% 96.48% +0.15%
==========================================
Files 7 7
Lines 1147 1168 +21
Branches 129 129
==========================================
+ Hits 1105 1127 +22
+ Misses 25 24 -1
Partials 17 17 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
RazerM
force-pushed
the
feature/session-state
branch
3 times, most recently
from
August 23, 2026 13:08
5940b5f to
0deb513
Compare
close() detached the finalizer and then performed the logout network round-trip before closing the HTTPX client, so a failing logout leaked the connection pool, with the ResourceWarning already suppressed by the detach. Wrap logout in try/finally in both clients.
The setter swapped hosts without clearing _authenticated or the in-memory predicate cache, whose key does not include the base URL (unlike the on-disk cache, which hashes it). The new host then received unauthenticated requests validated against the old host's predicates.
RazerM
force-pushed
the
feature/session-state
branch
from
August 23, 2026 13:45
0deb513 to
50d3098
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
close()now closes the underlying HTTPX client even when the logout request fails. Settingbase_urlnow resets the authentication state and the cached predicates, which belong to the previous host.