mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-02 04:48:48 -05:00
21 lines
534 B
CoffeeScript
21 lines
534 B
CoffeeScript
|
app = require('../../../../app')
|
||
|
require("logger-sharelatex").logger.level("error")
|
||
|
settings = require("settings-sharelatex")
|
||
|
|
||
|
module.exports =
|
||
|
running: false
|
||
|
initing: false
|
||
|
callbacks: []
|
||
|
ensureRunning: (callback = (error) ->) ->
|
||
|
if @running
|
||
|
return callback()
|
||
|
else if @initing
|
||
|
@callbacks.push callback
|
||
|
else
|
||
|
@initing = true
|
||
|
@callbacks.push callback
|
||
|
app.listen settings.internal.docstore.port, "localhost", (error) =>
|
||
|
throw error if error?
|
||
|
@running = true
|
||
|
for callback in @callbacks
|
||
|
callback()
|