title: Node Mysql queries queue but never execute
body: <p>I loop over some directories and then the files in them. I process the files by directory and then try to add the processed results into MySQL.
  I call conn.query('INSERT QUERY HERE') and it seems to continue on but the query never runs on the server. If I tell it to just process one directory and wait till the end it will run the queries but I can't have it continue to store all the queries in memory till the end of the script or node will fail out due to mem cap. I have tried everything I can think of to try and force the queued queries to run but no luck.</p>
  
  <p>Here is an example of my code</p>
  
  <pre><code>dirs.forEach(function(dir){
    var data = [];
    var connection = mysql.createConnection(conConfig);
    files.forEach(function(file){
      //do some processing on files push into data array 
      //creating array of objects
    });
    data.forEach(function(record){
      connection.query('INSERT INTO TABLE SET ?', record);
    });
    connection.end();
  });
  </code></pre>
  
  <p>The code will just continue to loop over the directories without ever sending the query to mysql. I know it will work by limiting the code to just run on one directory and it will runt he queries once the one directory is processed but not if I let it run on all directories.</p>
  
  <p>I have tried using mysql pooling as well with no luck. The
  <code>pool.on('enqueue' function...</code> will fire but never send it over to the server.</p>
  
  <p>edit:
  So I tried calling the script with a for loop from bash to call every dir name individually and all records were loaded. I'm dumbfounded as to why a mysql connection is never established in my orig example.</p>