Closed ddkohler closed 2 years ago
Summary of discussion with @ksunden
await
command, which will allow the daemon runner to close and avoid the infinite loop.In light of this, we have decided that this issue will be addressed within individual daemons and will not be a trait implementation.
Personally, I found this issue a useful lesson on how to implement async commands carefully (e.g. even consider failures).
_measure often follows the following syntax:
If a daemon uses the close method while looping (e.g. usb resources are told to close), _measure may try to initiate communication after comms close, which triggers an infinite loop of exceptions. As a result, the daemon never closes, and client restart commands fail. It's a nasty form of failure because I'm not sure many daemon devs would realize this could happen. It is not 100% reproducible either (I am seeing it ~20% of the time on my particular daemon).
I propose we give is-sensor a close method that stops the looping. But I'm not sure this is possible, and I'm also not sure it's a great solution. Daemon devs would have to make sure that daemons use the trait close method prior to any hardware disconnect commands.