altdesktop / i3ipc-python

🐍 An improved Python library to control i3wm and sway.
http://i3ipc-python.readthedocs.io
BSD 3-Clause "New" or "Revised" License
851 stars 109 forks source link

Graceful shutdown of script #162

Closed xeor closed 4 years ago

xeor commented 4 years ago

I am using i3ipc-python for a daemon having a bunch of i3.on watches. I change the script often, so I created some simple logic around killing the old version before a new one is started with exec_always.

Is there a need for graceful shutdown of anything in i3ipc-python (or if anyone know, i3.on watches)? And in which case, what is the correct way to do a graceful shutdown of a script?

This is a somewhat open question, but I couldn't find much docs about it..

acrisci commented 4 years ago

Call this to remove an event listener:

https://i3ipc-python.readthedocs.io/en/latest/connection.html#i3ipc.Connection.off

Otherwise you shouldn't have to do anything. If there are memory leaks then that's a bug. I haven't done any memory profiling recently so that could be a possibility. Let me know if you are having specific issues.

xeor commented 4 years ago

Thanks! I implemented the .off even tho it doesnt sound like it is absolutely needed.. Better safe than oom!