This fixes several areas in the code that were set up as "spin loops"; loops that would run as fast as the CPU they're on would let them. Instead, 2/3 fixes make use of Python's Queue.get() to block a thread until there is a new item in the queue to process.
The third "solution" is a hack that doesn't fully solve the problem, but mitigates the effect for now. A larger refactor will be required to properly improve this hotspot.
Before this PR, 3 CPUs would be pinned while running the backend (see image below). Now, running the backend shouldn't be noticeable (assuming it's not hard for the Pi to run with the current sleep rate).
Closes #67.
This fixes several areas in the code that were set up as "spin loops"; loops that would run as fast as the CPU they're on would let them. Instead, 2/3 fixes make use of Python's
Queue.get()
to block a thread until there is a new item in the queue to process.The third "solution" is a hack that doesn't fully solve the problem, but mitigates the effect for now. A larger refactor will be required to properly improve this hotspot.
Before this PR, 3 CPUs would be pinned while running the backend (see image below). Now, running the backend shouldn't be noticeable (assuming it's not hard for the Pi to run with the current sleep rate).