google-chrome - PouchDB 复制在复制时抛出错误

标签 google-chrome nginx couchdb ubuntu-14.04 pouchdb

当我尝试复制远程 couchdb 时(在 ubuntu 14.04- 64 bit 上)与我的本地 pouchdb ,我遇到了这个奇怪的错误。
我的 couchdb 是通过 nginx 代理的并在 https 上运行.从客户端到 nginx 的流量是 ssl,而 nginx 到 couchdb 是简单的 http。在 couchdb 中启用 Cors 请求。 Nginx 配置与 couchdb recommended 最相似.从数据库同步工作正常,但在通过 chrome 版本 54.0.2840.100 (64-bit) 调试时出现以下错误。

enter image description here

以下是错误的完整堆栈跟踪。
raven.min.js:2 Error: There was a problem getting docs. at finishBatch (http://localhost:8100/lib/pouchdb/dist/pouchdb.js:6410:13) at processQueue (http://localhost:8100/lib/ionic/js/ionic.bundle.js:27879:28) at http://localhost:8100/lib/ionic/js/ionic.bundle.js:27895:27 at Scope.$eval (http://localhost:8100/lib/ionic/js/ionic.bundle.js:29158:28) at Scope.$digest (http://localhost:8100/lib/ionic/js/ionic.bundle.js:28969:31) at http://localhost:8100/lib/ionic/js/ionic.bundle.js:29197:26 at completeOutstandingRequest (http://localhost:8100/lib/ionic/js/ionic.bundle.js:18706:10) at http://localhost:8100/lib/ionic/js/ionic.bundle.js:18978:7 at d (http://localhost:8100/lib/raven-js/dist/raven.min.js:2:4308) undefineda.(anonymous function) @ raven.min.js:2(anonymous function) @ ionic.bundle.js:25642(anonymous function) @ ionic.bundle.js:22421(anonymous function) @ angular.min.js:2processQueue @ ionic.bundle.js:27887(anonymous function) @ ionic.bundle.js:27895$eval @ ionic.bundle.js:29158$digest @ ionic.bundle.js:28969(anonymous function) @ ionic.bundle.js:29197completeOutstandingRequest @ ionic.bundle.js:18706(anonymous function) @ ionic.bundle.js:18978d @ raven.min.js:2 raven.min.js:2 Paused in lessondb replicate Error: There was a problem getting docs. at finishBatch (http://localhost:8100/lib/pouchdb/dist/pouchdb.js:6410:13) at processQueue (http://localhost:8100/lib/ionic/js/ionic.bundle.js:27879:28) at http://localhost:8100/lib/ionic/js/ionic.bundle.js:27895:27 at Scope.$eval (http://localhost:8100/lib/ionic/js/ionic.bundle.js:29158:28) at Scope.$digest (http://localhost:8100/lib/ionic/js/ionic.bundle.js:28969:31) at http://localhost:8100/lib/ionic/js/ionic.bundle.js:29197:26 at completeOutstandingRequest (http://localhost:8100/lib/ionic/js/ionic.bundle.js:18706:10) at http://localhost:8100/lib/ionic/js/ionic.bundle.js:18978:7 at d (http://localhost:8100/lib/raven-js/dist/raven.min.js:2:4308)
chrome中的网络日志显示部分请求被取消

enter image description here

我使用的是 couchdb 版本 - 1.6.1 和 pouchdb 版本 - 5.3.2。
我使用以下命令来复制数据库:
myDB.replicate.from(remote_db_url,{ live: true, retry: true, heartbeat: false }) 如果有人可以对 heartbeat parameter 有所了解,那也很棒。

最佳答案

注意:我无法解决您描述的错误。也许完整的堆栈跟踪而不是屏幕截图可能会有所帮助......

但我将尝试阐明心跳参数:阅读 docs已经有点帮助了。查看 replicate 的高级选项方法:

options.heartbeat: Configure the heartbeat supported by CouchDB which keeps the change connection alive.



那么让我们看看CouchDB's docs查看此参数的作用:

Networks are a tricky beast, and sometimes you don’t know whether there are no changes coming or your network connection went stale. If you add another query parameter, heartbeat=N, where N is a number, CouchDB will send you a newline character each N milliseconds. As long as you are receiving newline characters, you know there are no new change notifications, but CouchDB is still ready to send you the next one when it occurs.



所以基本上它似乎是一种轮询机制,每 n 毫秒(其中 n 是您指定的 heartbeat 值)发送一条消息(例如换行符)以确保两个数据库之间的连接仍然有效。

将值设置为 false将禁用此机制。

关于可用于此参数的值:
PouchDB docs进一步说明,changes方法有一个类似的参数描述如下:

options.heartbeat: For http adapter only, time in milliseconds for server to give a heartbeat to keep long connections open. Defaults to 10000 (10 seconds), use false to disable the default.

关于google-chrome - PouchDB 复制在复制时抛出错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/40866105/

相关文章:

html - chrome 输入中的未知边框

html - 使用 Google Chrome 检查元素属性

java - Nginx:如何将外部请求反向代理到特定的本地主机 URL

couchdb - CouchApp 无法从 View 中检索键/值对,但 Futon 可以

javascript window.open 在 safari 和 chrome 中不起作用

google-chrome - Chrome 扩展 - 使用文件系统 API

php - 如何使nginx和php容器之间进行通信

django - ssl 与 django Gunicorn 和 nginx

python - couchdb-python 和 map 函数 ViewField 执行

json - 使用 NoSQL 数据库对 JSON 数据进行高效且可扩展的存储