Is there a recommended way to prevent a promises that doesn't ever settle from blocking an express route? I came up with this but wanted to know if there are preferable options.
app.use((req, res, next) => {
const resultPromise = functionThatGetsAPromiseThatMightNotSettle();
const timeoutPromise = new Promise((resolve, reject) => {
setTimeout(() => reject('Timed Out', 10000);
})
Promise.race([resultPromise, timeoutPromise])
.then(res.send)
.catch(next)
})