Repository navigation
Conversation
alexanto
force-pushed
the
refactor/extract-aiohttp-transport
branch
from
November 5, 2026 13:28
72c4bb7 to
d26be36
Compare
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Malformed UTF-8 can overwrite cached feature state with altered values, and truncated error-response bodies can bypass configured retries.
2 open issues
What changed in this PR
Extracts aiohttp request handling into a dedicated async transport, mirroring the synchronous transport separation in #469 and preparing the async client for custom HTTP transports.
Changes:
- Adds an
AsyncTransportprotocol and a pooledAiohttpTransportimplementation. - Routes async API requests through an injectable transport with explicit ownership and cleanup.
- Adds transport tests and updates API-client tests for the new structure.
| File | Description |
|---|---|
UnleashClient/_transport.py |
Defines the async transport protocol. |
UnleashClient/_async_unleash_api_client.py |
Delegates HTTP operations and manages default transport ownership. |
UnleashClient/_aiohttp_transport.py |
Implements aiohttp requests, timeouts, and session lifecycle. |
tests/unit_tests/test_async_unleash_api_client.py |
Tests transport injection, request construction, and cleanup ownership. |
tests/unit_tests/test_async_metrics.py |
Updates the lazy-session assertion for transport-owned sessions. |
tests/unit_tests/test_aiohttp_transport.py |
Tests requests, responses, errors, session reuse, and closure. |
Review effort: Balanced
| _fetched_status(raw_state), | ||
| ) | ||
| resp = await self._transport.execute(request) | ||
| except RETRYABLE_ERRORS: |
| FetchStatus.NOT_CHANGED, | ||
| ) | ||
|
|
||
| raw_state = _text(resp) |
Contributor
Author
There was a problem hiding this comment.
i think this is worth fixing but will do in a separate PR
This branch has not been deployed
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.

async counterpart of #469