gpt4 book ai didi

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

转载 作者:行者123 更新时间:2023-12-03 22:23:50 24 4
gpt4 key购买 nike

当我尝试复制远程 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/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com