title: Error: Cannot enqueue Handshake after already enqueuing a Handshake
body: <p>I am fetching news feeds from different sources &amp; adding to DB but I get below exception</p>
  
  <blockquote>
    <p>Error: Cannot enqueue Handshake after already enqueuing a Handshake.
        at Protocol._validateEnqueue (/home/vikas/node_modules/mysql/lib/protocol/Protocol.js:210:16)
        at Protocol._enqueue (/home/vikas/node_modules/mysql/lib/protocol/Protocol.js:139:13)
        at Protocol.handshake (/home/vikas/node_modules/mysql/lib/protocol/Protocol.js:52:23)
        at Connection.connect (/home/vikas/node_modules/mysql/lib/Connection.js:130:18)
        at storeNewsFeedsInDB (/home/vikas/NodeJS Practice/fetchNews.js:42:7)
        at newsapi.v2.everything.then.response (/home/vikas/NodeJS Practice/fetchNews.js:33:9)
        at tryCatcher (/home/vikas/node_modules/bluebird/js/release/util.js:16:23)
        at Promise._settlePromiseFromHandler (/home/vikas/node_modules/bluebird/js/release/promise.js:512:31)
        at Promise._settlePromise (/home/vikas/node_modules/bluebird/js/release/promise.js:569:18)
        at Promise._settlePromise0 (/home/vikas/node_modules/bluebird/js/release/promise.js:614:10)
        at Promise._settlePromises (/home/vikas/node_modules/bluebird/js/release/promise.js:693:18)
        at Async._drainQueue (/home/vikas/node_modules/bluebird/js/release/async.js:133:16)
        at Async._drainQueues (/home/vikas/node_modules/bluebird/js/release/async.js:143:10)
        at Immediate.Async.drainQueues (/home/vikas/node_modules/bluebird/js/release/async.js:17:14)
        at runCallback (timers.js:637:20)
        at tryOnImmediate (timers.js:610:5)</p>
  </blockquote>
  
  <p>Below is my code</p>
  
  <pre><code>const NewsAPI = require('newsapi');
  const newsapi = new NewsAPI('*****************************');
  
  var mysql = require('mysql');
  var con = mysql.createConnection({
    host: "****",
    user: "****",
    password: "****",
    database: "****"
  });
  
  var channels = ['bbc-news', 'the-verge', 'reuters', 'cnbc', 'bloomberg', 'economist', 'nytimes'];
  var topics = ['technology', 'business', 'finance', 'tech', 'economics', 'company'];
  
  for (var i = 0; i &lt; channels.length; i++) {
    for (var j = 0; j &lt; topics.length; j++) {
      newsapi.v2.everything({
        q: topics[j],
        // q: 'technology',
        sources: channels[i],
        // sources: 'bloomberg',
        // domains: 'bbc.co.uk, techcrunch.com',
        from: '2018-03-14',
        to: '2018-03-14',
        language: 'en',
        sortBy: 'relevancy',
        pageSize:100,
        page: 1
      }).then(response =&gt; {
        // console.log(response);
        for (var i = 0; i &lt; response.articles.length; i++) {
          // console.log(response.articles[i].title);
          storeNewsFeedsInDB(response.articles[i].title, 
                              response.articles[i].description, 
                                response.articles[i].url);
        }
      });
    }
  }
  
  function storeNewsFeedsInDB(title, description, url) {
    con.connect(function(err) {
      if (err) throw err;
      console.log("Connected!");
  
      //Insert a record in the "newsfeeds" table:
      var sql = "INSERT IGNORE INTO newsfeeds (`title`, `description`, `url`) VALUES ('" 
                  + title.replace(/'/g, "\\'") + "', '" + description.replace(/'/g, "\\'") + "', '" + url + "')";
                  console.log(sql);
      con.query(sql, function (err, result) {
        if (err) throw err;
        console.log("1 record inserted");
      });
    });
  }
  </code></pre>
  
  <p>New to Nodejs &amp; Mysql, please help me.</p>