mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-26 09:11:58 +00:00
4763cfd59e
[misc] faster service shutdown in dev-env GitOrigin-RevId: c5589844aefe3ca097756b188e02354ab518b94d
27 lines
746 B
JavaScript
27 lines
746 B
JavaScript
// Metrics must be initialized before importing anything else
|
|
import '@overleaf/metrics/initialize.js'
|
|
|
|
import Settings from '@overleaf/settings'
|
|
import logger from '@overleaf/logger'
|
|
import { app } from './app/js/server.js'
|
|
import * as ASpell from './app/js/ASpell.js'
|
|
import Metrics from '@overleaf/metrics'
|
|
|
|
const { host = 'localhost', port = 3005 } = Settings.internal?.spelling ?? {}
|
|
|
|
ASpell.startCacheDump()
|
|
|
|
const server = app.listen(port, host, function (error) {
|
|
if (error) {
|
|
throw error
|
|
}
|
|
logger.info({ host, port }, 'spelling HTTP server starting up')
|
|
})
|
|
|
|
process.on('SIGTERM', () => {
|
|
ASpell.stopCacheDump()
|
|
server.close(() => {
|
|
logger.info({ host, port }, 'spelling HTTP server closed')
|
|
Metrics.close()
|
|
})
|
|
})
|