overleaf/services/docstore/test/acceptance/js/helpers/DocstoreApp.js

28 lines
670 B
JavaScript
Raw Normal View History

const app = require('../../../../app')
require('@overleaf/logger').logger.level('error')
const settings = require('@overleaf/settings')
2018-05-23 06:27:31 -04:00
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, '127.0.0.1', error => {
if (error != null) {
throw error
}
this.running = true
for (callback of Array.from(this.callbacks)) {
callback()
}
})
2021-07-13 07:04:48 -04:00
},
}