Skip to content

Conversation

trevorm4
Copy link

@trevorm4 trevorm4 commented Aug 12, 2025

Summary:
Many of the other client libraries have event driven async APIs, but python does not really have that currently. The best it has is get_subscription which acts as a polling api as it directly returns q.get() instead of returning the queue itself.

This diff adds an API to yield elements in the queue so that it can be used as an async generator to make the code more event driven.

Test Plan:
Aio has no tests currently, but open to suggestions!
I have tested it locally in my own application but in reality the asyncio version should probably have its own tests and be published on Pypi, but that is out of the scope of this diff.

@meta-cla meta-cla bot added the CLA Signed label Aug 12, 2025
@facebook-github-bot
Copy link
Contributor

@facebook-github-bot has imported this pull request. If you are a Meta employee, you can view this in D80124350. (Because this pull request was imported automatically, there will not be any future comments.)

@facebook-github-bot
Copy link
Contributor

@trevorm4 has updated the pull request. You must reimport the pull request before landing.

@facebook-github-bot
Copy link
Contributor

@trevorm4 has updated the pull request. You must reimport the pull request before landing.

@trevorm4 trevorm4 marked this pull request as ready for review August 12, 2025 22:18
@trevorm4 trevorm4 marked this pull request as draft August 12, 2025 22:21
Summary:
Many of the other client libraries have event driven async APIs, but python does not really have that currently. The best it has is `get_subscription` which acts as a polling api as it directly returns `q.get()` instead of returning the queue itself.

This diff adds an API to yield elements in the queue so that it can be used as an async generator to make the code more event driven.

Test Plan:
Aio has no tests currently, but open to suggestions!
I have tested it locally in my own application but in reality the asyncio version should probably have its own tests and be published on Pypi, but that is out of the scope of this diff.
@facebook-github-bot
Copy link
Contributor

@trevorm4 has updated the pull request. You must reimport the pull request before landing.

@trevorm4 trevorm4 marked this pull request as ready for review August 12, 2025 22:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants