反应堆缓存单触发器成功后取消

时间:2020-09-10 12:55:37

标签: reactive-programming spring-webflux project-reactor

来自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/741https://github.com/spring-projects/spring-framework/issues/22952

我认为CacheMono正在使用Mono.from(flux),并且cancel被调用next。我在reactor-addons下创建了一个问题。

我的假设正确吗?

0 个答案:

没有答案
相关问题