Closed cm226 closed 2 years ago
Hi @cm226,
Most people will use the in-memory version only for debugging and don't leave it running for too long. For most people, I'd assume the general assumption is that the document continues to live somewhere and is never deleted intentionally.
However, I do understand why you'd want to remove the document. There are legitimate reasons for doing that.
The y-websocket server is a minimalistic implementation of a Yjs backend. I suggest that you fork the server and modify it to your liking.
Describe the bug I think the web socket server indefinitely holds on to documents even when there are no active connections and persistence is not enabled.
Note that if persistence if enabled then this is not reproducible, which is the reason I think its a bug and not missing documentation.
To Reproduce
Expected behavior I think that step 4. should clean-up the memory for that document on the server. This seems like a memory leak to me, without the deleting of old documents long running servers continually consume memory, where different rooms are used.
I think the problem comes from this code in
closeConn
in/bin/utils.js
the doc is only destroyed in the case where persistence !== null
I think the fix is simple enough. I will prepare PR for it.
Environment Information
Huly®: YJS-518