Increase timeout for fetching camera data on Synology DSM#59237
Conversation
|
Hey there @hacf-fr, @Quentame, mind taking a look at this pull request as it has been labeled with an integration ( |
|
|
||
| try: | ||
| async with async_timeout.timeout(10): | ||
| async with async_timeout.timeout(30): |
There was a problem hiding this comment.
This is very long and will also delay startup of Home Assistant if the device is offline (because it is blocking during setup). Can you detect if it’s an NVR and if so, make it 30s ? Also what can take up to 30 seconds to reply, that sounds like some other issue
There was a problem hiding this comment.
the main problem is, that the surveillance_station.update in the library does multiple API calls sequentially - first gather all cameras, next iterate over each camera and gather the motion detection state.
In case of #58793 the "gather all cameras" lasts already 2s which returns 7 cameras ... each "gather motion detection state" lasts ~1-1.5s, those the 7th iteration was already causing the timeout - honestly the used NAS (model DS214) is not quiet powerful, but also actual models rely often on efficient small ARM cpu's.
Maybe we can limit the timeout to 20s to be more friendly to the entrance class NAS - sure, the overall solution should be to divide the data gathering into own update coordinators per each camera, but this needs also a rework of the library (already on my todo list for the upcoming winter months)
There was a problem hiding this comment.
btw if the NAS is not online during setup a ConfigEntryNotReady is raised
There was a problem hiding this comment.
I'm fine with accepting this now to relief some pressure for this release, but this is not the right fix. Instead of a global timeout it should have a timeout per request.
|
Forgot to link an additional issue (#58793) which will benefit from this PR |
Proposed change
This will increase the timeout from 10 to 30s for fetching camera data from "Surveillance Station" on Synology DSM, those it fixes running into timeout, when having some more cameras connected or encounter a higher systemload.
Type of change
Additional information
Checklist
black --fast homeassistant tests)If user exposed functionality or configuration variables are added/changed:
If the code communicates with devices, web services, or third-party tools:
Updated and included derived files by running:
python3 -m script.hassfest.requirements_all.txt.Updated by running
python3 -m script.gen_requirements_all..coveragerc.The integration reached or maintains the following Integration Quality Scale:
To help with the load of incoming pull requests: