Error: connect ENFILE 127.0.0.1:5984 - Local (undefined: undefined)

I keep getting this pouchDB error and I don't know what all this is about.

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)
+4
source share
1 answer

ENFILE Too many different file openings throughout the system. Please note that any number of linked channels counts as just one file open; See Related Channels. This error never occurs on GNU / Hurd systems.

Using this one promiseDebouncer, I turned up the call putand pressed it.

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)
+5
source

Source: https://habr.com/ru/post/1615346/


All Articles