[英]PouchDb <-> CouchDb Replicate
好吧,對不起圖片。
我讀到了 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')
})}
有時,如果設備長時間斷開連接,復制會停止,我必須重新啟動應用程序。
在網絡上,我可以看到停止請求超過四分鍾
編輯:在瀏覽器中一切正常,沒有問題。
問題出在帶有 android 的設備上
編輯:
當我啟動應用程序和網絡未連接時,我可以在日志中看到:
凈::ERR_INTERNET_DISCONNECTED
那太好了。
但是當我啟動應用程序和網絡連接並在幾秒鍾后斷開連接時,我只能在網絡中看到該請求處於待處理狀態而沒有錯誤。 當我在大約幾分鍾后打開網絡時,這個請求被執行,但是當我在大約五分鍾后關閉網絡時,這個請求處於待處理狀態,沒有改變狀態。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.