OpenHausIO / backend

HTTP API for the OpenHaus SmartHome/IoT solution
https://docs.open-haus.io
6 stars 2 forks source link

Refactor "command timeout" handling #500

Open mStirner opened 2 months ago

mStirner commented 2 months ago

The timeout should apply to the time between when the data was sendet and the answer from the device. When no connector is available, the connection timeout should apply, but instead the "command timeout" fires before the end of the "connection timeout" (default 30s) was reached.

When the connection timeout > command timeout (which is the case) then the command timeout fires every time before the connection timeout.

Correct flow would be: on success

on failure

NOTE: Keep in mind that changing this also affect the "Presets" handling in endpoints (#439)

mStirner commented 1 month ago

There are/should be 3 timeouts:

"Connection timeout" should be relative high e.g. 30s. "Command timeout" should be higher than response timeout, e.g. 5s. "Command response timeout" should be lower than "command timeout", e.g. 2s

3s between sending the command, and receiving a response from a API/device should be more than enough for the most scenarios.

The 5s "command timeout" is there to log that the command request/payload was not even written to the device/API. (is this even needed?, when "connect timeout" exists.)