Hi,
I have a question regarding the replication on couchbase-lite :
When I start a big replication, it seems to crash silently (I can’t find any log), and I have to start it again in order to get it running back. It fails mainly on old devices (iOS/Android), so I’m wondering if this has something to do with the device CPU being to much sought.
I have read this part of the documentation : https://docs.couchbase.com/couchbase-lite/current/java.html#replication (the part with Guaranteed Order Delivery / Maximum Throughput / Extreme Configurability ), but I don’t know if this has a link with my problem.
Here’s an extract of my code (java) starting the replication, if someone sees anything, feel free to correct me
public static Replicator startReplication() {
Log.i(TAG, "Replication Start with " + syncUsername);
try {
// Réinitialise le total
notifDocumentTotal = 0;
// Contrôle des données de réplications
if(syncUrl == null || syncChannel == null) {
throw new Exception("Informations du Replicator absentes");
} else if(replicator != null) {
Log.i(TAG, "Replication Exists");
return replicator;
}
Endpoint targetEndpoint = null;
try {
targetEndpoint = new URLEndpoint(new URI(syncUrl));
} catch (URISyntaxException e) {
Log.e(TAG, e.getMessage());
e.printStackTrace();
}
// Create replicators to push and pull changes to and from the cloud.
ReplicatorConfiguration config = new ReplicatorConfiguration(database, targetEndpoint);
// Limitation au channel de l'utilisateur
config.setChannels(Collections.singletonList(syncChannel));
config.setContinuous(true);
config.setReplicatorType(ReplicatorConfiguration.ReplicatorType.PUSH_AND_PULL);
// Authentification
config.setAuthenticator(new BasicAuthenticator(syncUsername, syncPassword));
// final CountDownLatch latch = new CountDownLatch(1);
replicator = new Replicator(config);
// Listener
replicator.addChangeListener(new ReplicatorChangeListener() {
@Override
public void changed(ReplicatorChange change) {
// Handling Errors
CouchbaseLiteException error = change.getStatus().getError();
if (error != null) {
Log.i(TAG, "ReplicatorChange error : " + error.getInfo());
}
// Activities
syncReplicatorStatus = change.getStatus().getActivityLevel().toString();
syncReplicatorProgressCompleted = change.getStatus().getProgress().getCompleted();
syncReplicatorProgressTotal = change.getStatus().getProgress().getTotal();
Log.i(TAG, "Replicator activity : " + change.getStatus().getActivityLevel());
// Fin de réplication
if(database != null && change.getStatus().getActivityLevel().toString().equals("IDLE")) {
// On force le décallage (bug CBL) en fin de réplication
syncReplicatorProgressCompleted = 100;
syncReplicatorProgressTotal = 100;
Log.i(TAG, "Database change count : " + database.getCount());
}
}
});
// Start replication.
replicator.start();
} catch (Exception e) {
Log.e(TAG, e.getMessage());
e.printStackTrace();
}
return replicator;
}
Thanks a lot