add timeout to super().request(). Ducobox may sometimes hang.#18
add timeout to super().request(). Ducobox may sometimes hang.#18wouterteepe wants to merge 1 commit into
Conversation
…quest Sikerdebaard#19 of hacs-ducobox-connector in an elegant way, at the source.
|
I encounter that quite often as well, however I never had to reboot my ducobox, only the client seems to stall |
Unfortunately, I have experienced worse (or: differently). While testing with the client from the CLI, response times sometimes increase to absurd lengths. At some moment I thought I went crazy and tried to connect using the Duco installation app, and even that one failed to get a response out of the Ducobox and actively suggested to power cycle the box. Long story short for: though sometimes it may be the client, certainly there are situations in which the box itself is to "blame". This fix helps dealing with that (particular but unfortunately for me common) situation, by detecting and reporting it properly. |
DucoUrlSessionextendsrequests.Sessionbut doesn't set timeouts on HTTP calls. When super().request() is called without a timeout parameter, requests can hang indefinitely.This is observed in pull request Sikerdebaard/hacs-ducobox-connector#39.
Instead of adding lots of code to that library, let's address it at the source.
The timeout is set at 15 seconds. No strong opinions on what the timeout should be, except that it should ideally be below one minute and allow some lag of the ducobox.
Please note that this issue can also occur without even using hacs-ducobox-connector, but just by using docupy itself. Or, more honestly, it occurs with the ducobox itself, which is sometimes not responsive. (I'll configure it to reboot frequently, but still the library should handle timeouts graceously).