ESOCKETTIMEDOUT 与远程 CouchDB
ESOCKETTIMEDOUT with remote CouchDB
我是 运行 具有 docker 的 CouchDB 服务器,我正在尝试 POST 通过 Node 应用程序获取数据。
但我经常收到 ESOCKETTIMEDOUT 错误提示(并非总是如此)。
这是我打开数据库连接的方式:
var remoteDB = new PouchDB('http://localhost:5984/dsndatabase', {
ajax: {
cache: true,
timeout: 40000 // I tried a lot of durations
}
});
这是用于发送数据的代码:
exports.sendDatas = function(datas,db, time) {
console.log('> Export vers CouchDB')
db.bulkDocs(datas).then(function () {
return db.allDocs({include_docs: true});
}).then(function (){
var elapsedTime = new Date().getTime() - time;
console.log('> Export terminé en ', elapsedTime, ' ms');
}).catch(function (err) {
console.log(err);
})
};
错误并非每次都出现,但我找不到模式。
而且,无论是否超时,我的所有数据都已成功加载到我的 CouchDB 中!
我看过很多关于这个问题的帖子,但是 none 确实回答了我的问题...
有什么想法吗?
好的,这似乎是真正的问题:
https://github.com/pouchdb/pouchdb/issues/3550#issuecomment-75100690
我认为您可以通过使用指数退避声明一个相当长的超时 value/a 重试逻辑来修复它。
让我知道这是否适合您。
我是 运行 具有 docker 的 CouchDB 服务器,我正在尝试 POST 通过 Node 应用程序获取数据。
但我经常收到 ESOCKETTIMEDOUT 错误提示(并非总是如此)。
这是我打开数据库连接的方式:
var remoteDB = new PouchDB('http://localhost:5984/dsndatabase', {
ajax: {
cache: true,
timeout: 40000 // I tried a lot of durations
}
});
这是用于发送数据的代码:
exports.sendDatas = function(datas,db, time) {
console.log('> Export vers CouchDB')
db.bulkDocs(datas).then(function () {
return db.allDocs({include_docs: true});
}).then(function (){
var elapsedTime = new Date().getTime() - time;
console.log('> Export terminé en ', elapsedTime, ' ms');
}).catch(function (err) {
console.log(err);
})
};
错误并非每次都出现,但我找不到模式。
而且,无论是否超时,我的所有数据都已成功加载到我的 CouchDB 中!
我看过很多关于这个问题的帖子,但是 none 确实回答了我的问题...
有什么想法吗?
好的,这似乎是真正的问题: https://github.com/pouchdb/pouchdb/issues/3550#issuecomment-75100690
我认为您可以通过使用指数退避声明一个相当长的超时 value/a 重试逻辑来修复它。
让我知道这是否适合您。