Skip to content

Commit

Permalink
Fixed externalServerService throwing error if trying to fill ipServer…
Browse files Browse the repository at this point in the history
…Map while the remote server is offline
  • Loading branch information
Alf-Melmac committed May 13, 2021
1 parent b27b627 commit ea1d3e5
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
import org.springframework.web.reactive.function.client.ClientResponse;
import org.springframework.web.reactive.function.client.WebClient;

import java.util.Collections;
import java.util.HashMap;
import java.util.Map;

Expand Down Expand Up @@ -46,7 +47,10 @@ public HttpStatus ping() {
*/
public void fillIpServerMap() {
log.info("Filling ipUrlMap from " + serverManagerProperties.getUrl());
ipServerMap = buildWebClient().get().uri("/status/mappings").retrieve().bodyToMono(new ParameterizedTypeReference<Map<String, String>>() {}).block();
ipServerMap = buildWebClient().get().uri("/status/mappings").retrieve()
.bodyToMono(new ParameterizedTypeReference<Map<String, String>>() {})
.onErrorReturn(Collections.emptyMap())
.block();
log.info("Filled ipUrlMap and retrieved {} items", ipServerMap != null ? ipServerMap.size() : "null");
}

Expand Down

0 comments on commit ea1d3e5

Please sign in to comment.