Express app.post getting called multiple times

前端 未结 1 1573
南笙
南笙 2021-01-13 14:27

I have been building a youtube video conversion app which streams youtube videos using youtube-dl and saves them, everything was working fine until I attempted to stream a v

1条回答
  •  -上瘾入骨i
    2021-01-13 14:59

    So after just getting down to a very basic post route and logging out some text but not returning a response, I came to the conclusion the issue resides with node. I decided to record the length of time between the console.log statements which turned out to be every 2 minutes. With this I was able to find out that node has a default timeout of 2 minutes if a response is not sent back to the client.

    I was able to set the response to never timeout with the following code:

    res.connection.setTimeout(0);

    I hope this helps anyone else that needs to hold connections for large periods of times for file conversions/transfers etc...

    0 讨论(0)
提交回复
热议问题