mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-06-04 14:49:01 +02:00
on domain error wait 3 seconds to send 500 to allow for other cleanup.
Also check inside function if the res has finished. #confused
This commit is contained in:
@@ -35,8 +35,10 @@ app.use (req, res, next) ->
|
||||
requestDomain.add req
|
||||
requestDomain.add res
|
||||
requestDomain.on "error", (err)->
|
||||
if !res.finished
|
||||
res.send(500)
|
||||
setTimeout(->
|
||||
if !res.finished
|
||||
res.send(500)
|
||||
, 3000)
|
||||
logger = require('logger-sharelatex')
|
||||
req =
|
||||
body:req.body
|
||||
|
||||
@@ -15,7 +15,8 @@ module.exports =
|
||||
FileHandler.getFile bucket, key, {format:format,style:style}, (err, fileStream)->
|
||||
if err?
|
||||
logger.err err:err, key:key, bucket:bucket, format:format, style:style, "problem getting file"
|
||||
res?.send? 500
|
||||
if !res.finished and res?.send?
|
||||
res.send 500
|
||||
else if req.query.cacheWarm
|
||||
logger.log key:key, bucket:bucket, format:format, style:style, "request is only for cache warm so not sending stream"
|
||||
res.send 200
|
||||
|
||||
Reference in New Issue
Block a user