Skip to content

fix: Race condition in lazy HTTP client initialization#117

Merged
akalex merged 2 commits intomasterfrom
bugfix/Fix-race-condition-in-lazy-HTTP-client-init
Mar 29, 2026
Merged

fix: Race condition in lazy HTTP client initialization#117
akalex merged 2 commits intomasterfrom
bugfix/Fix-race-condition-in-lazy-HTTP-client-init

Conversation

@akalex
Copy link
Copy Markdown
Member

@akalex akalex commented Mar 29, 2026

Replace synchronous _client property with async _get_client() guarded by asyncio.Lock to prevent concurrent coroutines from creating multiple httpx.AsyncClient instances. The close() method acquires the same lock to avoid races between teardown and initialization.

Replace synchronous `_client` property with async `_get_client()` guarded
by `asyncio.Lock` to prevent concurrent coroutines from creating multiple
`httpx.AsyncClient` instances. The `close()` method acquires the same lock
to avoid races between teardown and initialization.
@akalex akalex self-assigned this Mar 29, 2026
Poetry 1.x fails on the PEP-621 pyproject.toml introduced in 6d02f5b.
Consolidate the two-step install (--no-root + --no-interaction) into a
single `poetry install --no-interaction`.
@akalex akalex merged commit 6a494d7 into master Mar 29, 2026
16 checks passed
@akalex akalex deleted the bugfix/Fix-race-condition-in-lazy-HTTP-client-init branch March 29, 2026 06:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Development

Successfully merging this pull request may close these issues.

1 participant