来自CacheMono的单声道不必要地调用cancel
查看示例代码。
Map<String, String> cache = new HashMap<>();
Mono<String> fetchDataMono = Mono.just("Test").log();
Mono<String> cacheMono = CacheMono
.lookup(key -> Mono.justOrEmpty(cache.get(key))
.map(Signal::next),
"1")
.onCacheMissResume(() -> fetchDataMono)
.andWriteWith((key, signal) -> Mono.empty());
cacheMono.subscribe();
输出如下
reactor.Mono.Just.1 - | onSubscribe([Synchronous Fuseable] Operators.ScalarSubscription)
reactor.Mono.Just.1 - | request(unbounded)
reactor.Mono.Just.1 - | onNext(Test)
reactor.Mono.Just.1 - | cancel()
我遇到了2个相关问题。 https://github.com/reactor/reactor-netty/issues/741和https://github.com/spring-projects/spring-framework/issues/22952
我认为CacheMono
正在使用Mono.from(flux)
,并且cancel
被调用next
。我在reactor-addons
下创建了一个问题。
我的假设正确吗?