Thanks for the great module, it works great!!!
If you're looking to fix the H12 errors on Heroku, here's an example I created. I figured I would save some people some time. This example will allow you to keep the connection alive without timing out for 120 seconds before closing the connection and returning an empty object.
function sleep(ms) {
return new Promise(resolve => {
setTimeout(resolve, ms);
});
}
app.post('/testGet', (req, res, next) => {
const delayed = new DelayedResponse(req, res);
async function slowFunction() {
for (let i = 0; i < 120; i += 1) {
await sleep(1000);
console.log(`sleep ${i}`);
}
console.log("complete");
delayed.end(null, {});
}
slowFunction(delayed.start(10000, 10000));
}
);
Thanks for the great module, it works great!!!
If you're looking to fix the H12 errors on Heroku, here's an example I created. I figured I would save some people some time. This example will allow you to keep the connection alive without timing out for 120 seconds before closing the connection and returning an empty object.