PouchDB.sync()触发“完成”,但具有相同选项的PouchDB.replicate.from()仅触发“已暂停”-为什么?

时间:2019-07-07 16:01:21

标签: couchdb pouchdb

使用complete复制时,仅local.replicate.from(remote)不会触发paused事件。正在指定{ live: false }

根据文档,当live设置为false时,我应该收到一个complete事件。我的CouchDB服务器日志中没有任何我认为是错误的东西。

我正在使用pouch-browser 6.4.3

本地PouchDB选项:
{
    size: '1000',
    adapter: 'idb',
    auto_compaction: true,
    revs_limit: 1
}
“拉”代码:
local.replicate.from(remote, {
      live: false,
      batch_size: 50,
      batches_limit: 2,
      timeout: 5000,
    })
      .on('change', this.onChange.bind(this))
      .on('paused', this.onPause.bind(this))
      .on('active', this.onActive.bind(this))
      .on('denied', this.onDenied.bind(this))
      .on('complete', this.onComplete.bind(this))
      .on('error', this.onError.bind(this))
      .catch(this.handleError.bind(this));

这将拉下所有远程记录,一切正常,没有complete事件,只有paused。好像指定了live: true

这是我的同步代码-这总是会触发complete事件。 remote变量中PouchDB的实例是配置为使用代理身份验证的CouchDB服务器-此身份验证似乎工作正常。

双向复制代码:
local.sync(remote, {
      live: false,
      batch_size: 50,
      batches_limit: 2,
      timeout: 5000,
    })
      .on('change', this.onChange.bind(this))
      .on('paused', this.onPause.bind(this))
      .on('active', this.onActive.bind(this))
      .on('denied', this.onDenied.bind(this))
      .on('complete', this.onComplete.bind(this))
      .on('error', this.onError.bind(this))
      .catch(this.handleError.bind(this));

sync()方法始终会触发complete事件,就像我期望的那样。 live: false从来没有。

在这两种情况下为什么都没有收到local.replicate.from()事件的任何想法吗?

0 个答案:

没有答案