问题
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