2018-05-24 07:02:27 -04:00
|
|
|
app = require('../../../../app')
|
2020-01-24 12:30:03 -05:00
|
|
|
require("logger-sharelatex")
|
2018-05-24 07:02:27 -04:00
|
|
|
logger = require("logger-sharelatex")
|
|
|
|
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?.trackchanges?.port, "localhost", (error) =>
|
|
|
|
throw error if error?
|
|
|
|
@running = true
|
|
|
|
logger.log("track changes running in dev mode")
|
|
|
|
|
|
|
|
for callback in @callbacks
|
|
|
|
callback()
|