Express: Response time 25ms or 15s

Created on 17 Mar 2020  路  1Comment  路  Source: expressjs/express

I usage :
Nuxt js v 2.10.2
expressjs v 4.17.1
NodeJS v13.9.0

In the production version, I found unexpected behavior; any API request works up to 300 ms. But sometimes (one of 30 of any requests) takes 10-15 seconds. I thought there was not enough memory, but there were no errors at all. Any ideas ?
I checked the time with such a function :
const app = express()
app.use('/',function(req,res,next){
let date1 = +(new Date())
res.on('finish',()=>{
let time = +(new Date())-date1
if(time>1000)console.error( "Any text")}
})
next()
})
.........

awaiting more info question

Most helpful comment

Can you provide a minimal reproduction that demonstrates the behavior? Without seeing your code I can't tell what is happening that could cause this.

>All comments

Can you provide a minimal reproduction that demonstrates the behavior? Without seeing your code I can't tell what is happening that could cause this.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

haider0324 picture haider0324  路  3Comments

dmaks9 picture dmaks9  路  3Comments

zackarychapple picture zackarychapple  路  3Comments

snowdream picture snowdream  路  3Comments

nove1398 picture nove1398  路  3Comments