当我关闭网络并在几秒钟后打开网络时,我遇到了复制问题。
打开网络后,我必须在3-5分钟内等待复制同步:
在生产环境中,这可能是有问题的。
有什么想法吗?
发布于 2021-04-29 18:37:01
好吧,很抱歉弄错了图像。
我在pouchdb中读到有关复制和使用重试选项的信息
我的代码:
this.service.synch().then((data) => {
this.lottieSpashScreen.hide();
}).catch((err) => {
console.log('no network or couch not respond')
this.lottieSpashScreen.hide();
});
在服务中:
synch() {
let optionsToAndFrom = {
live: true,
retry: true,
continuous: true
};
this.db.replicate.to(this.remote, optionsToAndFrom)
return this.db.replicate.from(this.remote)
.on('complete', (info) => {
this.db.replicate.from(this.remote, optionsToAndFrom)
})
.on('error', (info) => {
console.log('error')
})}
有时,如果设备长时间断开连接,复制会停止,我必须重新启动应用程序。
在网络上,我可以看到请求停滞超过四分钟
编辑:在浏览器中一切运行正常,没有问题。
问题出在安卓设备上
编辑:
当我启动App和网络未连接时,我可以在日志中看到:
net::ERR_INTERNET_DISCONNECTED
这太棒了。
但当我启动应用程序和网络连接,几秒钟后断开连接后,我只能在网络中看到请求处于挂起状态,没有错误。当我在大约几分钟后打开网络时,此请求被执行,但当我在大约五分钟后关闭网络时,此请求处于挂起而无更改状态。
https://stackoverflow.com/questions/67280126
复制相似问题