From e61a7867b6012566fad36c39e8f8744352a75147 Mon Sep 17 00:00:00 2001 From: harry-hao Date: Mon, 18 Nov 2019 01:18:40 +0800 Subject: [PATCH] delay createPending() until findRoute() complete --- .../cloud/gateway/rsocket/core/GatewayRSocket.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/spring-cloud-rsocket-broker/src/main/java/org/springframework/cloud/gateway/rsocket/core/GatewayRSocket.java b/spring-cloud-rsocket-broker/src/main/java/org/springframework/cloud/gateway/rsocket/core/GatewayRSocket.java index 1069e5d..9e5af4b 100644 --- a/spring-cloud-rsocket-broker/src/main/java/org/springframework/cloud/gateway/rsocket/core/GatewayRSocket.java +++ b/spring-cloud-rsocket-broker/src/main/java/org/springframework/cloud/gateway/rsocket/core/GatewayRSocket.java @@ -178,7 +178,7 @@ private Mono> findRSocketOrCreatePending(GatewayExchange exchange) // put route in exchange for later use exchange.getAttributes().put(ROUTE_ATTR, route); return findRSocketOrCreatePending(exchange, route); - }).switchIfEmpty(createPending(exchange)); + }).switchIfEmpty(Mono.defer(() -> createPending(exchange))); // TODO: deal with connecting to cluster? }