How to cancel automatic reconnection when node-mssql uses connection pooling connection timeout

topic description

after the connection pool connection is successful, the connection timed out when performing the database operation. How to configure to return an error directly instead of trying to reconnect all the time

related codes

const to = require("await-to-js").default;
const sql = require("mssql");
const timeOut = require("../utils/timeOut");

const config = {
  user: "sa",
  password: "123",
  server: "127.0.0.1",
  database: "test",
  port: 1433,
  appName: "node-test",
  connectionTimeout: 5000,  //timeoutms  15000
  requestTimeout: 5000,//timeoutms15000
  //parseJSON: true,  //jsonjson obj
  options: {
    encrypt: false // ,Windows Azure,true
  },
  pool: {
    max: 100,
    min: 0,
    idleTimeoutMillis: 30000  //ms30000
  }
};

(async () => {
  let err, pool, result;
  for (; ;) {
    [err, pool] = await to(new sql.ConnectionPool(config).connect());
    if (!err) {
      pool.on("error", err => {
        console.error(err.message);
      });
      console.log(``);
      console.log(`SQL:${config.server}`);
      break;
    } else if (pool !== undefined) {
      pool.close();
    }
    console.error(err.message);
    console.error(`5...`);
    await timeOut(config.connectionTimeout);
  }
  // SQL Server
  await timeOut(15000);
  [err, result] = await to(pool.query`SELECT 1`);
  // 
  console.log(err, result);
})();
Nov.15,2021
MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b37ac8-2c0cc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b37ac8-2c0cc.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?