For a little more clarity the mongo call never fails. There is actually 
logging around it as now shown below which is always hit.

var Request = require('request');
downloadPDF : function(req, res) {
  Project.findById(req.params.Project_id, function(err, project) {
    project.findDoc(req.params.doc_id ,function(err, doc) {
      var pdfileName = doc.name + ".pdf";
      res.contentType(pdfileName);
      res.header('Content-Disposition', "filename=" + pdfileName);

      console.log("sending request for "+project._id);
      Request("http://localhost:3001/"; + project._id).pipe(res);
    });
  });
}


On Saturday, 21 April 2012 10:58:15 UTC+1, henry.oswald wrote:
>
> In my node site I call a restful API service I have built using a standard 
> http get. After a few hours of this communication successfully working I 
> find that the request stops being sent, it just waits and eventually times 
> out.
>
> The API that is being called is still receiving requests from elsewhere 
> perfectly well but when a request is sent from the site it does not reach 
> the API.
>
> The data being sent is a pdf of between 1 and 10 pages. I have tried with 
> stream.pipe, util.pump and just writing the file to the file system.
>
> I am using Node 0.6.15. My site and the service that is being called are 
> on the same server so calls to localhost are being made. Memory usage is 
> about 25% over all with cpu averaging about 10% usage.
>
> After a while of the problem I started using the 
> request<https://github.com/mikeal/request> module 
> but I get the same behaviour. The number of calls it makes before failing 
> varies it seems between 5 to 100. In the end I have to restart the site 
> but not the api to make it work again.
>
> Here is roughly what the code in the site looks like:
>
> var Request = require('request');
> downloadPDF: function(req, res) {
>   Project.findById(req.params.Project_id, function(err, project) {
>     project.findDoc(req.params.doc_id ,function(err, doc) {
>       var pdfileName = doc.name + ".pdf";
>       res.contentType(pdfileName);
>       res.header('Content-Disposition', "filename=" + pdfileName);
>       Request("http://localhost:3001/"; + project._id).pipe(res);
>     });
>   });
> }
>
> I am loss at what could be happening.
>

-- 
Job Board: http://jobs.nodejs.org/
Posting guidelines: 
https://github.com/joyent/node/wiki/Mailing-List-Posting-Guidelines
You received this message because you are subscribed to the Google
Groups "nodejs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/nodejs?hl=en?hl=en

Reply via email to