CouchBase Lite 连续复制停止

CouchBase Lite Continuous Replication Stops

我在使用 CBL 复制器时遇到了一个非常奇怪的问题:

全球:

public Replication _Push;
public Replication _Pull;

在初始化中:

        _DB = Manager.SharedInstance.GetDatabase(_DBName);
        if (_DB == null) throw new Exception("Unable to initialize CB Lite");

        _Push = _DB.CreatePushReplication(_DBServerURL);
        _Pull = _DB.CreatePullReplication(_DBServerURL);

        List<String> Channels = new List<string>();
        Channels.Add("TestChannel");

        _Push.Channels = Channels;
        _Pull.Channels = Channels;

        _Push.Start();
        _Pull.Start();

        _Push.Continuous = true;
        _Pull.Continuous = true;

问题是 Replicator 一开始处于 Active 状态,然后变为空闲状态,但最后变为 Stopped 并且 IT 不再 return。

CouchBase 文档告诉我:

... A continuous replication, on the other hand, will stay active indefinitely, watching for further changes to occur and transferring them. ...

Stopped: A one-shot replication goes into this state after all documents have been transferred or a fatal error occurs. (Continuous replications never stop.)

所以真的很奇怪... 我正在通过桌面应用程序对其进行测试....

我还检查了两个 LastError 对象,但即使停止连续复制,它们也为空...

问题已解决,似乎您必须在启动复制器之前将复制器设置为连续:

_Push.Continuous = true;
_Pull.Continuous = true;
_Push.Start();
_Pull.Start();