Handle errors in both subscriptions.
Previously errors in CachingRouteLocator were on handled on the interior subscribe, not it is handled in both. Fixes gh-1892
This commit is contained in:
@@ -82,7 +82,7 @@ public class CachingRouteLocator
|
||||
list -> Flux.fromIterable(list).materialize().collect(Collectors.toList()).subscribe(signals -> {
|
||||
applicationEventPublisher.publishEvent(new RefreshRoutesResultEvent(this));
|
||||
cache.put(CACHE_KEY, signals);
|
||||
}, throwable -> handleRefreshError(throwable)));
|
||||
}, this::handleRefreshError), this::handleRefreshError);
|
||||
}
|
||||
catch (Throwable e) {
|
||||
handleRefreshError(e);
|
||||
|
||||
@@ -21,7 +21,6 @@ import java.util.List;
|
||||
import java.util.concurrent.CountDownLatch;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import reactor.core.publisher.Flux;
|
||||
|
||||
@@ -67,7 +66,6 @@ public class CachingRouteLocatorTests {
|
||||
}
|
||||
|
||||
@Test
|
||||
@Ignore // FIXME: 3.0.0
|
||||
public void refreshWorksWhenFirstRefreshSuccessAndOtherError() throws InterruptedException {
|
||||
Route route1 = route(1);
|
||||
Route route2 = route(2);
|
||||
@@ -102,7 +100,7 @@ public class CachingRouteLocatorTests {
|
||||
|
||||
waitUntilRefreshFinished(locator, resultEvents);
|
||||
assertThat(resultEvents).hasSize(1);
|
||||
assertThat(resultEvents.get(0).getThrowable().getCause().getMessage()).isEqualTo("in chain.");
|
||||
assertThat(resultEvents.get(0).getThrowable().getMessage()).isEqualTo("in chain.");
|
||||
assertThat(resultEvents.get(0).isSuccess()).isEqualTo(false);
|
||||
assertThat(locator.getRoutes().collectList().block()).containsExactly(route1);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user