elbowz / xbmc.service.pushbullet

Pushbullet Notification Client
GNU General Public License v3.0
22 stars 12 forks source link

Gap on XBMC/Kodi closing #7

Closed elbowz closed 9 years ago

elbowz commented 10 years ago

The other bad thing of my code is websocket. I will try to explain... If you try to close xbmc, It will wait Pushbullet add-on going down, but the "websocket listen" is a blocking function (https://github.com/elbowz/xbmc.service.pushbullet/blob/master/lib/external/websocket/_app.py#L150) ....

For that I have set a ping_timeout here: https://github.com/elbowz/xbmc.service.pushbullet/blob/master/lib/pushbullet.py#L218

The issue: now Kodi waits 2 seconds (ping_timeout) waiting Pushbullet addon closing :(

I have tried to wrap websocket in a thread but however it don't close...

I could reduce ping_timeout to 1 second, but I don't know is a good solution.

Any ideas?

ruuk commented 10 years ago

In my testing, the delay from the call to close to the actual close was three seconds. Perhaps this is responsible: https://github.com/elbowz/xbmc.service.pushbullet/blob/master/lib/external/websocket/_core.py#L808

When I made this lower, it would just hang XBMC (if I recall correctly) and if I made it higher than 5 seconds, XBMC would try to kill the addon (and fail)

I don't think it's a problem for now, but I have done some stuff with non-blocking sockets in the past and maybe I could try something in the future.

I used a different WebSocket api than you, but I also had a delay when closing the session.

elbowz commented 10 years ago

Good catch!

I'm wrong...ping_timeout is not influence the xbmc gap on closing.

I'll increase this value...

elbowz commented 9 years ago

I think is done :)