连接错误:连接丢失 - 在量角器中读取 ECONNRESET



我正在使用量角器 52.2 和黄瓜 3.2.2。我正在使用硒网格(硒服务器独立-3.14.0.jar(与量角器一起使用,并在 4 个不同节点的 4 个浏览器中运行我的脚本。我在数据库中有一个包含 600 行的表。最初,我正在访问此表中的数据并通过我的量角器脚本输入每行的数据,并在成功输入每行后更新数据库列。但是在成功输入一些行后,量角器脚本突然以错误"ConnectionError: Connection lost - read ECONNRESET in protractor"结束。我在更新SQL查询中收到一条错误消息,指出">请求错误:资源ID:1。 数据库的请求限制为 60,并且已达到。请参阅'http://go.microsoft.com/fwlink/?LinkId=267637'以获取帮助。下面给出了我正在使用的更新查询(我使用的是 azure sql(。我不清楚如何解决这个问题。提前谢谢。

var Connection = require('tedious').Connection;
var Request = require('tedious').Request;
var config = 
{
userName: 'xxx', 
password: 'xxxxx', 
server: 'xxxxxx', 
options: 
{
database: 'xxx' ,
encrypt: true,
rowCollectionOnRequestCompletion: true
}
}
var connection = new Connection(config);
defineSupportCode(function ({ setDefaultTimeout, Given, When, Then }) {
setDefaultTimeout(30000 * 1000);
function updatedb(LPAID){
request = new Request("UPDATE COM_Location_Post with (rowlock) SET IsPublished = 1 WHERE Id ="+LPAID,function(err,rowCount, rows) { 
if(err){
console.log(err)
}
});
connection.execSql(request);
}
});

您在脚本中没有使用连接关闭。

通过您的问题,在最大实例之后您面临此问题后很清楚。

尝试每次为每笔交易关闭连接。

(async () => {
const config = {
user: 'User',
password: 'iPg$',
server: 'cp-sql',
database: 'DBI',
options: {
encrypt: true // Use this if you're on Windows Azure
}
}
try {
let pool = await sql.connect(config)
var envcode, testcode;
let result1 = await pool.request()
.query(`query 1 goes here`)
// console.dir(result1)
pool.close();
sql.close();
let pool1 = await sql.connect(config)
let result2 = await pool1.request()
.query(`query 2 goes here`)
// console.dir(result2)
pool1.close();
sql.close();
resolve(result2);
} catch (err) {
console.log(err)
}
})()

最新更新