Node.js maximum call stack exceeded

I've have the same question as earlier but having trouble relating the answers to my code. Here's my error: RangeError: Maximum call stack size exceeded.

The highly simplified version of my code is this:

function make_request(url, other_params){     request(url, function(response){      if(something) var some_var = 'some value';     else var some_var = '';      //do something with response to generate, some_var, and insert into DB      var my_arr = [some_var];      connection.query('INSERT my_table SET name = ?', my_arr, function(err, rows, fields) {          if(my_arr==''){                // generate new url to make new request                function make_request(url, other_params);          }     });    }); }  connection.query('SELECT * from my_table', function(err, rows, fields){    var len =rows.length;    for(var i = 0; i < len; i++){      var url = rows[i].url;      make_request(url, other_params);    }      }); 

I've tried wrapping the internal make_request in setImmediate or setTimeout amongst a few other hacks, but nothing seems to prevent the call stack error. I'm able to add any library that would make this work. Any thoughts would be appreciated.


Category: javascript Time: 2016-07-29 Views: 0

Related post

iOS development

Android development

Python development

JAVA development

Development language

PHP development

Ruby development


Front-end development


development tools

Open Platform

Javascript development

.NET development

cloud computing


Copyright (C), All Rights Reserved.

processed in 0.115 (s). 12 q(s)