allow to disable gc in server

This commit is contained in:
Kevin Jahns 2019-09-18 15:13:09 +02:00
parent db3a3e3732
commit dcd6e4c772

View File

@ -162,15 +162,12 @@ const pingTimeout = 30000
* @param {any} conn * @param {any} conn
* @param {any} req * @param {any} req
*/ */
exports.setupWSConnection = (conn, req) => { exports.setupWSConnection = (conn, req, { docName = req.url.slice(1), gc = true }) => {
conn.binaryType = 'arraybuffer' conn.binaryType = 'arraybuffer'
// get doc, create if it does not exist yet // get doc, create if it does not exist yet
/**
* @type {string}
*/
const docName = req.url.slice(1)
const doc = map.setIfUndefined(docs, docName, () => { const doc = map.setIfUndefined(docs, docName, () => {
const doc = new WSSharedDoc(docName) const doc = new WSSharedDoc(docName)
doc.gc = gc
if (persistence !== null) { if (persistence !== null) {
persistence.bindState(docName, doc) persistence.bindState(docName, doc)
} }