upgrade express

This commit is contained in:
Shane Kilkelly 2020-03-19 15:20:32 +00:00
parent aa324a1920
commit f069a2515d
4 changed files with 269 additions and 442 deletions

View file

@ -21,15 +21,14 @@ mongojs = require "./app/js/mongojs"
async = require "async"
Path = require "path"
bodyParser = require "body-parser"
Metrics.mongodb.monitor(Path.resolve(__dirname + "/node_modules/mongojs/node_modules/mongodb"), logger)
Metrics.event_loop.monitor(logger, 100)
app = express()
app.configure ->
app.use(Metrics.http.monitor(logger));
app.use express.bodyParser({limit: (Settings.max_doc_length + 64 * 1024)})
app.use app.router
app.use(Metrics.http.monitor(logger));
app.use bodyParser({limit: (Settings.max_doc_length + 64 * 1024)})
Metrics.injectMetricsRoute(app)
DispatchManager.createAndStartDispatchers(Settings.dispatcherCount || 10)
@ -68,11 +67,11 @@ app.get '/flush_all_projects', HttpCont
app.get '/flush_queued_projects', HttpController.flushQueuedProjects
app.get '/total', (req, res)->
timer = new Metrics.Timer("http.allDocList")
timer = new Metrics.Timer("http.allDocList")
RedisManager.getCountOfDocsInMemory (err, count)->
timer.done()
res.send {total:count}
app.get '/status', (req, res)->
if Settings.shuttingDown
res.send 503 # Service unavailable
@ -87,7 +86,7 @@ app.get "/health_check/redis", (req, res, next) ->
res.send 500
else
res.send 200
docUpdaterRedisClient = require("redis-sharelatex").createClient(Settings.redis.documentupdater)
app.get "/health_check/redis_cluster", (req, res, next) ->
docUpdaterRedisClient.healthCheck (error) ->
@ -99,7 +98,7 @@ app.get "/health_check/redis_cluster", (req, res, next) ->
app.get "/health_check", (req, res, next) ->
async.series [
(cb) ->
(cb) ->
pubsubClient.healthCheck (error) ->
if error?
logger.err {err: error}, "failed redis health check"

File diff suppressed because it is too large Load diff

View file

@ -21,9 +21,10 @@
},
"dependencies": {
"async": "^2.5.0",
"body-parser": "^1.19.0",
"bunyan": "~0.22.1",
"coffee-script": "~1.7.0",
"express": "3.11.0",
"express": "4.17.1",
"lodash": "^4.17.13",
"logger-sharelatex": "^1.7.0",
"metrics-sharelatex": "^2.5.1",

View file

@ -1,4 +1,5 @@
express = require("express")
bodyParser = require("body-parser")
app = express()
MAX_REQUEST_SIZE = 2*(2*1024*1024 + 64*1024)
@ -36,7 +37,7 @@ module.exports = MockWebApi =
else
res.send 404
app.post "/project/:project_id/doc/:doc_id", express.bodyParser({limit: MAX_REQUEST_SIZE}), (req, res, next) =>
app.post "/project/:project_id/doc/:doc_id", bodyParser({limit: MAX_REQUEST_SIZE}), (req, res, next) =>
MockWebApi.setDocument req.params.project_id, req.params.doc_id, req.body.lines, req.body.version, req.body.ranges, req.body.lastUpdatedAt, req.body.lastUpdatedBy, (error) ->
if error?
res.send 500