Skip to content

Delayed response keeps connection open? #1

@PanMan

Description

@PanMan

Hi!
Could it be the connection isn't closed properly after the response?
I'm using this on Heroku, to keep the connection open when generating a PDF.
The code is below. But recently it started throwing H15 desc="Idle connection" errors.
Any pointers?

    res.setHeader('content-type', 'text/html');
    res.write('Creating PDf... Wait for it...');

    var delayed = new DelayedResponse(req, res);
    delayed.start()

    makeFullPdf( function(pdfurl){
      console.log('PDF ready');
      var html='<br/><A HREF="'+pdfurl+'"> Open PDF</A>';
      html+='<script>window.location="'+pdfurl+'"; </script>'; //JS as we can't send headers at this point
      delayed.end(null, html);
      res.end();
    })

Thanks!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions