smallrye-mutiny icon indicating copy to clipboard operation
smallrye-mutiny copied to clipboard

Timeout not thrown when using memoize()

Open guldner opened this issue 5 years ago • 1 comments

memoize().indefinitely() doesn't seem to work the same as cache().

After upgrading from 0.9.0 to 0.13.0 (as a result of upgrading quarkus), one of my Unis doesn't fail with a timeout. The following is not being triggered:

.ifNoItem().after(Duration.ofSeconds(externalCallsTimeoutSeconds)).fail()
                .onFailure(TimeoutException.class).transform(throwable -> {

Use case: I have a uni created with Uni.combine().all().unis(listOfUnis).combinedWith(combinator).cache(); It combines several rest client calls to backend services. I then have two subscribers for that, one that will timeout as shown above, and another that doesn't time out. If there's no timeout the second subscriber is cancelled. The reason for this is to return an error (to the user) if it takes too long to produce a result, but when that happens, still wait for the backend services and build and cache the result for a later request from the user.

I've reproduced the behaviour in the two attached projects, one for each version 0.9 and 0.13. mutiny-cache.zip mutiny-memoize.zip

Java 11 and 12. Gradle 6.7

Edit: I should add that it fails only when having two subscribers.

guldner avatar Jan 26 '21 11:01 guldner

I submitted a fix in #463.

cescoffier avatar Jan 27 '21 12:01 cescoffier