snjoetw / py-synology

Python API for Synology Surveillance Station
MIT License
30 stars 15 forks source link

sid timeout for long-lasting instances #3

Closed cmsimike closed 6 years ago

cmsimike commented 6 years ago

Hi,

I have come from the home-assistant community where we're having an issue around SIDs expiring and causing any instanced SurveillanceStation instances to become stale, requiring a full restart of the app.

What are your thoughts about your library silently re-establishing connections in cases like that? Meaning when you get an exception from Synology: https://github.com/home-assistant/home-assistant/issues/12037

Just recreate the API?

snjoetw commented 6 years ago

Thanks for raising this, I'll have a look this weekend to see what should be done. Ideally this should be handled inside this lib

cmsimike commented 6 years ago

@snjoetw Thank you for the response! I'll put my hass PR into a WIP state (I fix this manually in there) but if the connection can be re-established inside your lib, I think that would be the absolute best.

snjoetw commented 6 years ago

@cmsimike what do you think of this PR? https://github.com/snjoetw/py-synology/pull/4

cmsimike commented 6 years ago

@snjoetw Thank you for your work on this, and apologies for the delay in getting back to you. I will test this out and let you know.

cmsimike commented 6 years ago

Installed! Ill report back in a few days.

snjoetw commented 6 years ago

Thanks! Hopefully this fixes your problem.

btw how do you reproduce it? Do you just leave it run for a few days and it’ll start erroring out?

It’s weird that I’ve never seen the error myself. I have a DS216+II with DSM 6.2

cmsimike commented 6 years ago

Exactly that. I (unfortunately) never paid too much attention when it goes out but eventually after a few days the cameras won't load anymore and I am spammed in the log with exception.

snjoetw commented 6 years ago

Closing this one and will integrate with next home assistant release