feat(node): push USB changes and preserve sensor setup across sessions
This commit is contained in:
@@ -0,0 +1,23 @@
|
||||
import asyncio
|
||||
import threading
|
||||
|
||||
from k1link.fleet.events import FleetEvents
|
||||
|
||||
|
||||
def test_registry_events_cross_thread_coalesce_and_unsubscribe():
|
||||
async def check():
|
||||
events = FleetEvents()
|
||||
queue, close = events.subscribe()
|
||||
thread = threading.Thread(target=lambda: [events.notify() for _ in range(20)])
|
||||
thread.start()
|
||||
thread.join()
|
||||
await asyncio.sleep(0)
|
||||
assert queue.qsize() == 1
|
||||
await queue.get()
|
||||
close()
|
||||
events.notify()
|
||||
await asyncio.sleep(0)
|
||||
assert queue.empty()
|
||||
assert not events.listeners
|
||||
|
||||
asyncio.run(check())
|
||||
Reference in New Issue
Block a user