rudders / homebridge-http

HTTP Plugin for Homebridge
Apache License 2.0
178 stars 110 forks source link

Pull Request: type of a cached way of reading status, seems very responsive, and doesnt crash like realtime #43

Closed cybertza closed 7 years ago

cybertza commented 7 years ago

Round about rev 1.

Still working on it a bit, but its functional.

and i have run the release for 24 hours and have bashed it many times during that, haven't been able to crash it my side.

NovaGL commented 7 years ago

When I have time I will test it out. So when would you use cached?

I don't really want to merge a WIP so when its final let me know. I will certainly have a look though

cybertza commented 7 years ago

@NovaGL

So with yes what i am getting at the moment is that the first get of the data is slow its 8 X http requests, so it takes time to get back, at that point the phone is locked again, so i let that happen and then the second pull i have is fast, almost instant when local, and quick remotely.

Cached i want to make a hybrid between realtime and yes, so when the device does a request, it will do an instant reply of the last value the device had, causing an indefinite instant response. after the replies has been honor i want to then do a quick poll like you do with the realtime, and update all the statuses, and do push updates to the devices, just like you do with real-time. but after that i want to go towards a slow poll status that takes time to scan the devices, like once every 5 mins or so, and try and get the staggered, so in all effect if i take yes, make it always serve from cache and have a background process that cycles thru the devices then it will be great. although, the more im typing here, it may just be better for me to try crash real time again and start handling those errors.

let me play with it for a hour or 2 and see what i come up with i have updated the documentation some with normal questions i see around.

NovaGL commented 7 years ago

Your recent changes will break this plugin so it can't be merged. Please do another merge request with these conflicts resolved. Or fix it up in your latest pull request.