Couchbase:无法分派请求,取消而不是重试 [英] Couchbase: Could not dispatch request, cancelling instead of retrying
本文介绍了Couchbase:无法分派请求,取消而不是重试的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在异步运行查询的情况下,客户端崩溃并显示以下错误:
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.
连接设置:
final CouchbaseEnvironment env = DefaultCouchbaseEnvironment
.builder()
.queryEndpoints(1)
.retryStrategy(FailFastRetryStrategy.INSTANCE)
.build();
异步查询示例:
Observable<SiteData> dataList = bucket
.async()
.query(query)
.flatMap(AsyncN1qlQueryResult::rows)
.map(row -> new SiteData(row.value()));
推荐答案
原因是 queryEndpoints
设置为1,策略设置为 FailFastRetryStrategy
,因此,异步运行两个请求,将会失败,因为只有一个端点,并且在发生任何异常的情况下策略都会失败.
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.
升高 queryEndpoints
或将策略更改为 BestEffortRetryStrategy
或同时执行以下两种操作:
Rise the queryEndpoints
or change strategy to BestEffortRetryStrategy
or do both:
final CouchbaseEnvironment env = DefaultCouchbaseEnvironment
.builder()
.queryEndpoints(2)
.retryStrategy(BestEffortRetryStrategy.INSTANCE)
.build();
这篇关于Couchbase:无法分派请求,取消而不是重试的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文