PouchDB ETIMEDOUT error

不问归期 提交于 2019-12-24 00:49:37

问题


So we've been building an app that uses couchDb/cloudant with Pouchdb as our driver client side (ionic framework) and server side (node).

Of late we've been getting errors when connecting to the remote, that seem to appear at random and only disappear temporarily restarting the app, or opening a new browser.

update-data.service.js:38 Error: ETIMEDOUT(…)(anonymous function) @ update-data.service.js:38processQueue @ angular.js:16383(anonymous function) @ angular.js:16399$eval @ angular.js:17682$digest @ angular.js:17495(anonymous function) @ angular.js:17721completeOutstandingRequest @ angular.js:5964(anonymous function) @ angular.js:6243

When running in incognito browser though temporarily removed the issue (or seperate browser) but the error always comes back.

Starting and stopping couch seems to also temporarily solve the problem.

Issue comes up unpredictably when running as an app (both android and ios) with cloudant as the backend

Have not seen it yet on node.js server.

Any possible avenues or directions that we could explore?


回答1:


I have these ETIMEDOUT errors from PouchDB when the HTTP request to a remote database cannot be done, presumably because of a poor internet connection.

If there is up and downs in your connection you can try to increase the duration before a timeout error is thrown (see the options for remote databases in the doc):

var remote = new PouchDB('address', {
  ajax: {
    timeout: 60000,
  }
});

In the above example, a timeout error will be thrown only if the HTTP request cannot be done for 60 seconds.



来源:https://stackoverflow.com/questions/39534600/pouchdb-etimedout-error

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!