title: failed to connect to xxxxx:xxxx in 150000ms node mssql
body: <p>I have a node js job. This job is using node-cron to run some logic in every hour.
  It's connecting to sql server database using node mssql package.</p>
  
  <p>connection file code:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>const sql = require('mssql');
  const conn = (function () {
      try {
          return new sql.ConnectionPool(obj);
      }
      catch (err) {
          throw err;
      }
  }())
  
  
  const pool = (function () {
      try {
          return conn.connect();
      }
      catch (err) {
         throw err;
      }
  }());
  
  
  
  const myConn = async function getConn() {
      try {
          return await pool;
      } catch (err) {
          throw err;
      }
  };
  
  module.exports = {
      myConn    
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Code to call stored procedure:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>async function callProc(procedureName, inputList, callback) {
      try {
          const pool = await connectionFile.myConn();
          const request = new sql.Request(pool);
          if (inputList) {
              for (const param of inputList) {
                  request.input(param.name, param.type, param.value);
              }
          }
          const result = await request.execute(procedureName);
          callback(null, result);
      }
      catch (err) {
          callback(err, null);
      }
  }</code></pre>
  </div>
  </div>
  </p>
  
  <p>Intermittently my job is failing with error "failed to connection to  in 15000ms"</p>
  
  <p>Any suggestion?</p>