mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-02 14:01:13 +00:00
Merge pull request #3568 from overleaf/ae-mongo-promises
Wait for mongoose to connect before starting the server GitOrigin-RevId: 4b470369b070f17b32e47106fada7cb4adf2a12c
This commit is contained in:
parent
d266179333
commit
181f9f88fb
2 changed files with 3 additions and 2 deletions
|
@ -25,6 +25,7 @@ if ((Settings.sentry != null ? Settings.sentry.dsn : undefined) != null) {
|
||||||
metrics.memory.monitor(logger)
|
metrics.memory.monitor(logger)
|
||||||
const Server = require('./app/src/infrastructure/Server')
|
const Server = require('./app/src/infrastructure/Server')
|
||||||
const mongodb = require('./app/src/infrastructure/mongodb')
|
const mongodb = require('./app/src/infrastructure/mongodb')
|
||||||
|
const mongoose = require('./app/src/infrastructure/Mongoose')
|
||||||
const Queues = require('./app/src/infrastructure/Queues')
|
const Queues = require('./app/src/infrastructure/Queues')
|
||||||
|
|
||||||
Queues.initialize()
|
Queues.initialize()
|
||||||
|
@ -44,8 +45,7 @@ if (!module.parent) {
|
||||||
if (!process.env.WEB_API_USER || !process.env.WEB_API_PASSWORD) {
|
if (!process.env.WEB_API_USER || !process.env.WEB_API_PASSWORD) {
|
||||||
throw new Error('No API user and password provided')
|
throw new Error('No API user and password provided')
|
||||||
}
|
}
|
||||||
mongodb
|
Promise.all([mongodb.waitForDb(), mongoose.connectionPromise])
|
||||||
.waitForDb()
|
|
||||||
.then(() => {
|
.then(() => {
|
||||||
Server.server.listen(port, host, function() {
|
Server.server.listen(port, host, function() {
|
||||||
logger.info(`web starting up, listening on ${host}:${port}`)
|
logger.info(`web starting up, listening on ${host}:${port}`)
|
||||||
|
|
|
@ -56,5 +56,6 @@ async function getNativeDb() {
|
||||||
}
|
}
|
||||||
|
|
||||||
mongoose.getNativeDb = getNativeDb
|
mongoose.getNativeDb = getNativeDb
|
||||||
|
mongoose.connectionPromise = connectionPromise
|
||||||
|
|
||||||
module.exports = mongoose
|
module.exports = mongoose
|
||||||
|
|
Loading…
Reference in a new issue