Couchbase: Could not dispatch request, cancelling instead of retrying

杀马特。学长 韩版系。学妹 提交于 2019-12-12 03:56:55

问题


In the case of running queries asynchronously, client crash with the error:

com.couchbase.client.core.RequestCancelledException: Could not dispatch request, canceling instead of retrying.

Connection Settings:

final CouchbaseEnvironment env = DefaultCouchbaseEnvironment
  .builder()
  .queryEndpoints(1)
  .retryStrategy(FailFastRetryStrategy.INSTANCE)
  .build();

Async query example:

Observable<SiteData> dataList = bucket
  .async()
  .query(query)
  .flatMap(AsyncN1qlQueryResult::rows)
  .map(row -> new SiteData(row.value()));

回答1:


The reason is queryEndpoints set to 1 and strategy to FailFastRetryStrategy, so, running two requests asynchronously, will fail because there is only one endpoint and strategy is to fail in the case of any exception.

Rise the queryEndpoints or change strategy to BestEffortRetryStrategy or do both:

final CouchbaseEnvironment env = DefaultCouchbaseEnvironment
  .builder()
  .queryEndpoints(2)
  .retryStrategy(BestEffortRetryStrategy.INSTANCE)
  .build();


来源:https://stackoverflow.com/questions/43123836/couchbase-could-not-dispatch-request-cancelling-instead-of-retrying

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!