allow to disable gc in server
This commit is contained in:
parent
db3a3e3732
commit
dcd6e4c772
@ -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)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user