Okay, sorry for image.
I was read about replication in pouchdb and using retry option
My code:
this.service.synch().then((data) => {
this.lottieSpashScreen.hide();
}).catch((err) => {
console.log('no network or couch not respond')
this.lottieSpashScreen.hide();
});
In service:
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')
})}
Sometimes if a device is disconnected a long of time, replication stop and I have to restart app.
ON the network I can see that stalled on request is over four minutes
Edit: In browser everything working okay, without problem.
Problem is on device with android
EDIT:
When I started App and network not connect I can see in log:
net::ERR_INTERNET_DISCONNECTED
And thats great.
But when I started app and network connect and after few seconds disconnected I can see only in network that request is in pending status without error. When I turn on network after about minutes this request exectued but when I network off after about five minutes this request is in pending without changes status.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.