poe-api
poe-api copied to clipboard
close it correctly on error
Hello. As I understand it, your python library has a problem - the websocket will not close correctly when an error occurs.
Here's an example: if it runs for 7-8 hours without API restarts (by ChimeraGPT example) - you get "too many open files". client.disconnect_ws()
in finally block partially helps, but not completely.
I investigated and came to the conclusion that your library reconnects (sometimes or always) if it gives an exception to client code or client.disconnect_ws()
call at the end
How to close resources correctly? How do I "fight" it?
I'm currently on vacation so there's not much I can do other than merge pull requests. If you want to contribute, please do so to the ws-rewrite
branch, since I have already started to clean up some of the websocket code there.
For now, you can probably work around this by simply re-creating the Client
object every hour or so.