mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2025-07-30 17:00:08 +02:00

* [document-updater] flush history for projects with short queues ASAP * [k8s] document-updater: enable short history queue for history-ot demo * [project-history] flush history for projects with short queues ASAP * [project-history] wait for mongo before running acceptance tests * [k8s] project-history: enable short history queue for history-ot demo * [project-history] change wait-for-mongo step in tests Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com> --------- Co-authored-by: Eric Mc Sween <eric.mcsween@overleaf.com> GitOrigin-RevId: 3e989c409e8e9887655b35f2659ce0829e61b357
45 lines
1.2 KiB
JavaScript
45 lines
1.2 KiB
JavaScript
// TODO: This file was created by bulk-decaffeinate.
|
|
// Fix any style issues and re-enable lint.
|
|
/*
|
|
* decaffeinate suggestions:
|
|
* DS101: Remove unnecessary use of Array.from
|
|
* DS102: Remove unnecessary code created because of implicit returns
|
|
* DS205: Consider reworking code to avoid use of IIFEs
|
|
* DS207: Consider shorter variations of null checks
|
|
* Full docs: https://github.com/decaffeinate/decaffeinate/blob/master/docs/suggestions.md
|
|
*/
|
|
import { app } from '../../../../app/js/server.js'
|
|
import { mongoClient } from '../../../../app/js/mongodb.js'
|
|
|
|
let running = false
|
|
let initing = false
|
|
const callbacks = []
|
|
|
|
export function ensureRunning(callback) {
|
|
if (callback == null) {
|
|
callback = function () {}
|
|
}
|
|
if (running) {
|
|
return callback()
|
|
} else if (initing) {
|
|
return callbacks.push(callback)
|
|
}
|
|
initing = true
|
|
callbacks.push(callback)
|
|
app.listen(3054, '127.0.0.1', error => {
|
|
if (error != null) {
|
|
throw error
|
|
}
|
|
|
|
// Wait for mongo
|
|
mongoClient.connect(error => {
|
|
if (error != null) {
|
|
throw error
|
|
}
|
|
running = true
|
|
for (callback of Array.from(callbacks)) {
|
|
callback()
|
|
}
|
|
})
|
|
})
|
|
}
|