-
-
Notifications
You must be signed in to change notification settings - Fork 48
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove asyncio.sleep(self.min_period) from Worker threads
The 0.1s sleep was introduced in [#22](#22) to reduce CPU usage due to the `RXWorker` busy looping. However, this sleep constrains PyTAK from receiving more than 10 messages per seconds. Decreasing the sleep period increases CPU usage again. This commit removes the unneeded sleep from both `RXWorker.run()` and `Worker.run().` * `RXWorker.run()` was already sleeping in `self.reader.readuntil()` or `self.reader.recv()`. * In `TXWorker.run()`, we replace `self.queue.get_nowait()` with `self.queue.get()`. We address the reason for using `get_nowait()` by introducing a new method for testing purposes, `TXWorker.run_once()`, which `TXWorker.run() calls in a loop.
- Loading branch information
1 parent
d57bd8a
commit 0a1fa3d
Showing
7 changed files
with
32 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters