overleaf/services/docstore/test/acceptance/js/helpers/DocstoreApp.js
Eric Mc Sween 1f566c3556 Merge pull request #10911 from overleaf/em-upgrade-mongo-docstore
Upgrade the Mongo driver in docstore

GitOrigin-RevId: 35e5de558e7900fcb455f1044703912077273d47
2022-12-16 09:02:59 +00:00

27 lines
670 B
JavaScript

const app = require('../../../../app')
require('@overleaf/logger').logger.level('error')
const settings = require('@overleaf/settings')
module.exports = {
running: false,
initing: false,
callbacks: [],
ensureRunning(callback) {
if (this.running) {
return callback()
} else if (this.initing) {
return this.callbacks.push(callback)
}
this.initing = true
this.callbacks.push(callback)
app.listen(settings.internal.docstore.port, 'localhost', error => {
if (error != null) {
throw error
}
this.running = true
for (callback of Array.from(this.callbacks)) {
callback()
}
})
},
}