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

Ensure that pygls.Server uses the event loop it is given #336

Merged
merged 1 commit into from
May 21, 2023

Conversation

alcarney
Copy link
Collaborator

@alcarney alcarney commented May 19, 2023

Description (e.g. "Related to ...", etc.)

Before this commit pygls would override the event loop for the current thread even when given an existing loop to use.

Now pygls will rely on asyncio.new_event_loop to create the appropriate event loop for the platform and only call it when loop=None

This commit also introduces the _own_loop flag which is used to make sure pygls does not close an event loop it does not own.

Related: #334

Code review checklist (for code reviewer to complete)

  • Pull request represents a single change (i.e. not fixing disparate/unrelated things in a single PR)
  • Title summarizes what is changing
  • Commit messages are meaningful (see this for details)
  • [/] Tests have been included and/or updated, as appropriate
  • [/] Docstrings have been included and/or updated, as appropriate
  • [/] Standalone docs have been updated accordingly
  • [/] CONTRIBUTORS.md was updated, as appropriate
  • Changelog has been updated, as needed (see CHANGELOG.md)

@alcarney alcarney requested a review from tombh May 19, 2023 19:27
Before this commit `pygls` would override the event loop for the
current thread even when given an existing loop to use.

Now `pygls` will rely on `asyncio.new_event_loop` to create the
appropriate event loop for the platform and only call it when
`loop=None`

This commit also introduces the `_own_loop` flag which is used to make
sure `pygls` does not close an event loop it does not own.
Copy link
Collaborator

@tombh tombh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

❤️

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.

2 participants