Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace async Event with bool #1846

Merged
merged 3 commits into from
Oct 12, 2024

Conversation

Olegt0rr
Copy link
Contributor

@Olegt0rr Olegt0rr commented Oct 12, 2024

Description

@Lancetnik asked to replace the awaiting of asyncio.Event in favor of asyncio.sleep in a loop, so that the implementation would be similar to uvicorn:
https://github.com/encode/uvicorn/blob/079f07a06457717b6f8c4b23bab7674d5f0568c1/uvicorn/server.py#L222-L229

The solution with asyncio.Event in the __init__ did not allow amateurs to use global object storage to use the library correctly, cause event instance became attached to another event loop.

I proposed an option to ensure compatibility with the use of asyncio.Event with lazy creation, but @Lancetnik asked for asyncio.sleep only. So I copy solution from unicorn.

Fixes #1837

Type of change

Please delete options that are not relevant.

  • Documentation (typos, code examples, or any documentation updates)
  • Bug fix (a non-breaking change that resolves an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a fix or feature that would disrupt existing functionality)
  • This change requires a documentation update

Checklist

  • My code adheres to the style guidelines of this project (scripts/lint.sh shows no errors)
  • I have conducted a self-review of my own code
  • I have made the necessary changes to the documentation
  • My changes do not generate any new warnings
  • I have added tests to validate the effectiveness of my fix or the functionality of my new feature
  • Both new and existing unit tests pass successfully on my local environment by running scripts/test-cov.sh
  • I have ensured that static analysis tests are passing by running scripts/static-analysis.sh
  • I have included code examples to illustrate the modifications

@Olegt0rr Olegt0rr marked this pull request as ready for review October 12, 2024 08:44
faststream/_internal/application.py Outdated Show resolved Hide resolved
@Lancetnik Lancetnik added this pull request to the merge queue Oct 12, 2024
Merged via the queue into airtai:main with commit 08b86ee Oct 12, 2024
30 checks passed
@Olegt0rr Olegt0rr deleted the bugfix/replace-event-with-bool branch October 12, 2024 10:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bug:App with RabbitBroker fails in v0.5.25
2 participants