Unable to sync data after a network disconnection
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 35/100
- Tipo de issue
- Error
- Claridad
- Necesita aclaración
- Estado de actividad
- Estancado
- Stack tecnológico
- android, angular, javascript
Línea de trabajo
Comienza con los puntos de entrada createPouchDB, postPouchDB, syncPouchDB y handlePouchDBError del servicio enlazado y, después, reproduce una breve interrupción de red con las versiones indicadas de PouchDB, Cordova Android y CouchDB. Compara los logs de pausado, activo y error para determinar por qué el live retry deja de avanzar; se considera terminado cuando la sincronización se reanuda y los datos siguen moviéndose después de la reconexión.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Description
I've been using pouchdb on tablets using it to syncing data from multiple tablets on a couchdb server. While using my tablets I occasionnally loose internect connection for a few microseconds. In most cases no issues but on few instances the sync seems to not work anymore and i do not get any more data from my tablets.
Info
- Environment: Pouch 7.3.1
- Platform: Cordova Android 11 & Angular 14
- Server: CouchDB 3.3.1 and PouchDB Server
Reproduce
I know the context can be very specific but i'll still link samples of my pouchdb service and some logs i've got spotting this issue. I do send data using the postPouchDB function
Service
public createPouchDB(id: string) {
const nameDB = id + '-' + this.deviceUUID;
const remoteNameDB = id + '-' + this.deviceUUID;
this.localDB = new PouchDB(nameDB);
this.localDB
.createIndex({
index: {
fields: ['id'],
},
})
.then((index_session) => {
this.logService.logDebug('Index : ' + JSON.stringify(id));
})
.catch(function (err) {
this.logService.logError('createIndex error : ' + JSON.stringify(err));
this.handlePouchDBError(err);
});
this.remoteDB = new PouchDB(this.environmentService.environment.urlCouchdb + remoteNameDB, {
auth: {
username: this.environmentService.environment.usernameCouchdb,
password: this.environmentService.environment.passwordCouchdb,
},
});
}
public postPouchDB(answer: Answer) {
this.logService.logInfo(`postPouchDB answer : ${JSON.stringify(answer)}`);
this.localDB.post(answer);
}
public syncPouchDB() {
// this syncs in both directions: from remote and to remote
this.localDB
.sync(this.remoteDB, {
live: true, // continuously sync between local and remote.
retry: true, // Retry on connection lost.
})
.on('paused', (info) => {
// replication was paused, usually because of a lost connection.
this.logService.logDebug('La replication a été mise en pause : ' + JSON.stringify(info));
this.tabletteAnimationLogService.createLog('pause', JSON.stringify(info), 'pouchdb');
})
.on('active', (info) => {
// replication was resumed.
this.logService.logDebug('La replication a été activée : ' + JSON.stringify(info));
})
.on('change', (change) => {
// something did change.
this.logService.logDebug('Il y a eu un changement dans la synchronisation pouchDB : ' + JSON.stringify(change));
})
.on('error', (error) => {
// error happened.
this.logService.logError('Il y a eu une erreur dans la synchronisation pouchDB : ' + JSON.stringify(error));
this.tabletteAnimationLogService.createLog('error', JSON.stringify(error), 'pouchdb');
this.handlePouchDBError(error);
});
}
protected handlePouchDBError(error) {
const pouchDBError = PouchDBErrors.generateErrorFromResponse(error);
this.logService.logError("PouchDBError : " + JSON.stringify(pouchDBError));
}
Logs
2025-01-17 12:28:59.664 : DEBUG : La replication a été mise en pause : undefined
2025-01-17 12:29:01.443 : DEBUG : La replication a été activée : {"direction":"push"}
2025-01-17 12:29:01.765 : DEBUG : La replication a été mise en pause : undefined
2025-01-17 12:29:04.060 : DEBUG : La replication a été activée : {"direction":"push"}
2025-01-17 12:29:04.480 : DEBUG : La replication a été mise en pause : undefined
2025-01-17 12:29:06.438 : DEBUG : La replication a été activée : {"direction":"push"}
2025-01-17 12:29:06.830 : DEBUG : La replication a été mise en pause : undefined
2025-01-17 12:29:07.873 : DEBUG : La replication a été activée : {"direction":"push"}
2025-01-17 12:29:08.219 : DEBUG : La replication a été mise en pause : undefined
It seems that it trys to sync but soen't succeed and does it again.
Thanks for the help !
- Lenguaje dominante
- JavaScript
- Estrellas
- 17.6k
- Forks
- 1.5k
- Métricas de merge de PR
- Sin PR fusionados en 30 d
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de apache/pouchdb
-
elemMatch throws TypeError: value is null if array has null elementPosiblemente ocupada @henyanagar la tomó hace 142 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
unref event is not documentedAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Validate database namesAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 22/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 55/100
-
Dificultad 3/5 1-2 días Aptitud para principiantes 65/100
Todos los issues de apache/pouchdb
Issues similares
-
[ordering-review] workshop order graph: 1 confirmed ordering problem, 3 cycles are false positivesAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
githubnext/gh-aw-workshop#5331 ·
Los mantenedores suelen responder en 1 día
-
Remove: 21 SexturyAbiertochannels:remove check:passed
Dificultad 1/5 Menos de una hora Aptitud para principiantes 65/100
Los mantenedores suelen responder en 4 días
-
[vika] console keeps a stale "in progress" turn after a daemon restart mid-runPosiblemente ocupada Un pull request vinculado a esta issue está abierto o ya se fusionó. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
volcengine/OpenViking#7011 ·
Los mantenedores suelen responder en 1 día
-
__VERSION__ within dist build is not replaced, causes missing version in XDM implementation detailsAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Issue: ready for confirmation Reported on 2.4.9 Triage: Dev.Experience
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
magento/magento2#41773 · 1 comentario ·
Los mantenedores suelen responder en 5 días