fixed problem with slow event server

This commit is contained in:
Simon Pirkelmann 2020-11-14 16:40:33 +01:00
parent 708284749d
commit 2060d8eb15

View File

@ -20,6 +20,9 @@ class MeasurementHandler(socketserver.BaseRequestHandler):
while not self.server.estimator.event_queue.empty(): while not self.server.estimator.event_queue.empty():
event = self.server.estimator.event_queue.get() event = self.server.estimator.event_queue.get()
self.request.sendall((json.dumps(event) + '\n').encode()) self.request.sendall((json.dumps(event) + '\n').encode())
self.server.estimator.last_event = None
time.sleep(1.0 / self.server.max_measurements_per_second)
else: else:
# send robot position # send robot position
try: try: