openrgb-python icon indicating copy to clipboard operation
openrgb-python copied to clipboard

Timeout ?

Open AR2000AR opened this issue 1 year ago • 5 comments

When not using actively the open connexion, the next read/write operation (e.g set_color()) will failed as disconnected, however regularly calling update() will fix the issue.

The Client class may need a kind of keepalive mechanic

AR2000AR avatar Apr 05 '24 19:04 AR2000AR

Repo with my source code : https://gitea.ar2000.me/AR2000/ed_led_sync

AR2000AR avatar Apr 06 '24 12:04 AR2000AR

Interesting. This is probably an issue with how the FileSystemEventHandler runtime works. It probably puts the process to sleep until something changes in the file, which apparently closes the socket or something. That's my guess at least. I haven't looked far enough into the docs to know for sure.

If you have something that works, great! I would probably just put the first operation you do after a break in a try block. Something like this will probably work:

def on_modified(self, event):
    try:
        cli.update()
    except OpenRGBDisconnected:
        cli.connect()
    ...

That way you'd just reconnect as needed instead of constantly sending data.

jath03 avatar Apr 06 '24 21:04 jath03

You mentioned that it also happened in the interpreter. Were you using watchdog there as well?

jath03 avatar Apr 06 '24 21:04 jath03

No I'm not. In the interpret I have nothing else loaded. Only the client. But if I forget ot for a while, when comming back to it it crashes (openrgb crashes too)

AR2000AR avatar Apr 07 '24 01:04 AR2000AR

Interesting. This is probably an issue with how the FileSystemEventHandler runtime works. It probably puts the process to sleep until something changes in the file, which apparently closes the socket or something. That's my guess at least. I haven't looked far enough into the docs to know for sure.

Since it happen also in the interpreter it cannot be that

AR2000AR avatar Apr 07 '24 13:04 AR2000AR