Closed jdeanwallace closed 1 year ago
I'd like to take a step back and rethink how we resolve #1026.
I know that this is still in draft, but it seems like we've created a significant amount of churn moving code from JS to Python when it seems like the underlying problem is that the backend is not staying responsive to HTTP/websockets requests when it's processing a large number of sequential HID messages. I'd like to solve that underlying problem before we get too deep into the JS -> Python migration because it doesn't seem like this fix strictly depends on the migration.
My concern with this PR is:
app/hid/keyboard.py
are bleeding out into api.py
multiprocessing
and bytearray
feel too low level for API-level logic.Is there a way we can fix #1026 in the app/hid
modules? It's okay if we have to adjust the semantics to add a param like release_after
or something, but I don't want to bleed out things like buffers or multiprocessing
.
I'd like to solve the threading issue first, because if we fix that, then maybe the whole chain starting from #1545 becomes unnecessary.
Resolves https://github.com/tiny-pilot/tinypilot/issues/1026 Dependent on https://github.com/tiny-pilot/tinypilot/pull/1557
Writing individual keystrokes to the HID interface is slow, resulting in API requests to paste large amounts of text to timeout. This PR writes multiple keystrokes to the HID interface at once, and does so asynchronously.