open-rmf / rmf_ros2

Internal ROS infrastructure for RMF
Apache License 2.0
74 stars 60 forks source link

Dispatcher only use websockets when dispatch fails #355

Closed aaronchongth closed 6 months ago

aaronchongth commented 6 months ago

Bug fix

Fixed bug

This is not technically a bug, but rather a bit of a workaround due to https://github.com/tortoise/tortoise-orm/issues/792

Due to this issue upstream (a fix for a newer version is on the way), there are occasions where the API server receives responses from the dispatcher via ROS 2 api response and websocket responses in quick succession where the DB still has no entry to the task ID yet.

Even with a mutex for this state save, it still doesn't resolve it.

This workaround only sends out a state update via websocket (if server URI is provided), when the task dispatch fails

This way, when a task dispatch succeeds, the API server will only hear from a single source, the ROS 2 API responses.