gpt4 book ai didi

javascript - azurestorage 和 NodeJS 中的 getaddrinfo 错误

转载 作者:行者123 更新时间:2023-11-30 16:36:43 24 4
gpt4 key购买 nike

我正在做一个应用程序,将文件发送到Azure存储容器,然后向Azure队列发送消息。

当我达到大约 1000~1020 条消息时,我无法发送更多文件和消息。我还注意到,当我尝试检查队列中有多少消息时,出现错误。

错误是:

    { [Error: getaddrinfo EADDRINFO] code: 'EADDRINFO', errno: 'EADDRINFO', syscall: 'getaddrinfo' }

我的代码是:

function start(pos) {

var entry = inputs[pos]; // The array stars at 0 (zero)
console.log(entry); // Print current file

//Let's start the uploading
blobSvcInput.createContainerIfNotExists(containerInput, function(error, result, response){ // this function will create a container in Azure Storage (if this does not already exist)
if(!error){
// The Container was created or already exist
blobSvcInput.createBlockBlobFromLocalFile(containerInput, "input"+pos, entry, function(error, result, response){ // this function will create a new Blob in Azure Storage (Uploading the entry)
if(!error){
//No errors occurred - File uploaded

//Now we will send a message to the Azure Queue
setTimeout(function(){ sendMsg(pos); }, 0);

}else{
//An error occurred when upload the file. We need to start again.
console.log("Error when uploading Blob.");
console.log(error);
console.log(result);
console.log(response);
setTimeout(function(){ start(pos); }, 2500);

}
});
}else{
// An error occurred when was trying create a Container
console.log("Error when creating Container.");

console.log(error);
console.log(result);
console.log(response);


// We need to try again
setTimeout(function(){ start(pos); }, 2500);

}
});
}

发送消息的函数是:

function sendMsg (pos) {
//Here I'll format the content of my message
var msg = formatMessage(pos,1);


queueSvc.createQueueIfNotExists(queue, function(error, result, response){ // Create Queue, if it does not exist
if(!error){ // Queue already exist or was created

queueSvc.createMessage(queue, msg, function(error, result, response){ // Send the message

if(!error){//Success sending the message

totalMsgsSent++; // Just for control
pos += parallelSend;
if(pos <= inputs.length){
setTimeout(function(){ start(pos); }, 0);
}
}else{
//Error occurred when sending the message
console.log("Error occurred when sending the message")
console.log(error);
console.log(result);
console.log(response);
setTimeout(function(){ sendMsg(pos); }, 2000);
}
});


}else{
//Occurred a error when creating the queue
console.log("Occurred a error when creating the queue")
console.log(error);
console.log(result);
console.log(response);
setTimeout(function(){ sendMsg(pos); }, 2000);
}
});

}

我真的迷路了。谢谢。

最佳答案

通常,EADDRINFO 是一种错误类型,在找不到 IP 地址的情况下查找主机名的 IP 地址时可能会发生这种错误。我没有看到你的代码有问题。您能否启用详细日志并分享遇到问题的请求?要启用详细日志,您可以调用:


var storage = require('azure-storage');
blobSvcInput.logger.level = storage.Logger.LogLevels.DEBUG;
queueSvc.logger.level = storage.Logger.LogLevels.DEBUG;

关于javascript - azurestorage 和 NodeJS 中的 getaddrinfo 错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32613999/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com