Javascript 错误:connect ENFILE 127.0.0.1:5984-本地(未定义:未定义)
我一直在犯这个错误,我不知道这是怎么回事Javascript 错误:connect ENFILE 127.0.0.1:5984-本地(未定义:未定义),javascript,node.js,couchdb,pouchdb,Javascript,Node.js,Couchdb,Pouchdb,我一直在犯这个错误,我不知道这是怎么回事 Error: connect ENFILE 127.0.0.1:5984 - Local (undefined:undefined) at onError (/Users/thomas/Desktop/rain/node_modules/pouchdb/lib/deps/ajax/ajaxCore.js:53:18) at Request._callback (/Users/thomas/Desktop/rain/node_modules
Error: connect ENFILE 127.0.0.1:5984 - Local (undefined:undefined)
at onError (/Users/thomas/Desktop/rain/node_modules/pouchdb/lib/deps/ajax/ajaxCore.js:53:18)
at Request._callback (/Users/thomas/Desktop/rain/node_modules/pouchdb/lib/deps/ajax/ajaxCore.js:103:14)
at self.callback (/Users/thomas/Desktop/rain/node_modules/request/request.js:198:22)
at emitOne (events.js:77:13)
at Request.emit (events.js:169:7)
at Request.onRequestError (/Users/thomas/Desktop/rain/node_modules/request/request.js:867:8)
at emitOne (events.js:77:13)
at ClientRequest.emit (events.js:169:7)
at Socket.socketErrorListener (_http_client.js:265:9)
at emitOne (events.js:77:13)
at Socket.emit (events.js:169:7)
at emitErrorNT (net.js:1253:8)
at doNTCallback2 (node.js:450:9)
at process._tickCallback (node.js:364:17)
ENFILE整个系统中有太多不同的文件开口。请注意,任何数量的链接通道都算作仅打开一个文件;请参见链接频道。GNU/Hurd系统上从未发生此错误
使用这个promisedbouncer
我包装了put
调用并限制了它
function promiseDebounce(fn, delay, count) {
var working = 0, queue = [];
function work() {
if ((queue.length === 0) || (working === count)) return;
working++;
Promise.delay(delay).tap(function () { working--; }).then(work);
var next = queue.shift();
next[2](fn.apply(next[0], next[1]));
}
return function debounced() {
var args = arguments;
return new Promise(function(resolve){
queue.push([this, args, resolve]);
if (working < count) work();
}.bind(this));
}
}
let debouncePut = promiseDebounce(db.put, 1000, 100).bind(db)
功能承诺(fn、延迟、计数){
var working=0,queue=[];
职能工作(){
if((queue.length==0)| |(working==count))返回;
工作++;
delay(delay).tap(函数(){working--;}).then(work);
var next=queue.shift();
next[2](fn.apply(next[0],next[1]);
}
返回函数去Bounced(){
var args=参数;
返回新承诺(函数(解析){
push([this,args,resolve]);
如果(工作<计数)工作();
}.约束(这个);
}
}
let debouncePut=promiseDebounce(db.put,1000100).bind(db)