Turn KeepAliveHandler into an asyncio.Task #94

Open
Gnome-py wants to merge 1 commits from Gnome-py/KeepAliveHandler-task into 2.0
Gnome-py commented 2021-10-07 16:28:54 +00:00 (Migrated from github.com)

Summary

For unknown reasons, the KeepAliveHandler was a thread, which just sleeps and does run_coroutine_threadsafe, which seemed kinda dumb to me. This is also the reason for a thread per voice channel, as KeepAliveHandler was subclassed for VoiceKeepAliveHandler.

This PR turns the thread into an asyncio.Task, and just uses asyncio.wait_for and await for the calls.

Checklist

  • If code changes were made then they have been tested.
    • I have updated the documentation to reflect the changes.
  • This PR fixes an issue.
  • This PR adds something new (e.g. new method or parameters).
  • This PR is a breaking change (e.g. methods or parameters removed/renamed)
  • This PR is not a code change (e.g. documentation, README, ...)
<!-- Pull requests that do not fill this information in will likely be closed --> ## Summary <!-- What is this pull request for? Does it fix any issues? --> For unknown reasons, the `KeepAliveHandler` was a thread, which just sleeps and does `run_coroutine_threadsafe`, which seemed kinda dumb to me. This is also the reason for a thread per voice channel, as `KeepAliveHandler` was subclassed for `VoiceKeepAliveHandler`. This PR turns the thread into an `asyncio.Task`, and just uses `asyncio.wait_for` and `await` for the calls. ## Checklist <!-- Put an x inside [ ] to check it, like so: [x] --> - [x] If code changes were made then they have been tested. - [ ] I have updated the documentation to reflect the changes. - [ ] This PR fixes an issue. - [ ] This PR adds something new (e.g. new method or parameters). - [ ] This PR is a breaking change (e.g. methods or parameters removed/renamed) - [ ] This PR is **not** a code change (e.g. documentation, README, ...)
This pull request can be merged automatically.
You are not authorized to merge this pull request.

Checkout

From your project repository, check out a new branch and test the changes.
git fetch -u origin Gnome-py/KeepAliveHandler-task:Gnome-py/KeepAliveHandler-task
git checkout Gnome-py/KeepAliveHandler-task
Sign in to join this conversation.
No description provided.