happyleavesaoc / python-orvibo

MIT License
36 stars 20 forks source link

Speed up communication #4

Closed kirberich closed 8 years ago

kirberich commented 8 years ago

Hi,

there was a small bug in _udp_transact which caused it to retry until the socket timed out, so every request would take 1 second. I've fixed that one and I also went ahead and changed the subscription logic so that it only resubscribes every 60 seconds instead of for every control request.

I went for 60 seconds because I don't know how long the timeout for subscriptions really is, it could probably be a fair big longer than that.

For me, these changes make communication about twice as fast, but it depends massively on network conditions. The main benefit comes from the _udp_transact fix, the subscription only makes everything slightly faster.