poe-api icon indicating copy to clipboard operation
poe-api copied to clipboard

close it correctly on error

Open zentixua opened this issue 1 year ago • 2 comments

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?

zentixua avatar Jun 27 '23 14:06 zentixua

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.

ading2210 avatar Jun 28 '23 03:06 ading2210