From 29f3c25a4423bf471e5d4a1328e5705a840377b0 Mon Sep 17 00:00:00 2001 From: John Niang Date: Thu, 30 Mar 2023 11:00:18 +0800 Subject: [PATCH] Fix the problem of listing users with unstable result (#3635) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit #### What type of PR is this? /kind bug /area core #### What this PR does / why we need it: Use concatMap instead of flatMap to ensure stable result. Please see the differences between flatMap and concatMap from links below: - https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html#flatMap-java.util.function.Function- - https://projectreactor.io/docs/core/release/api/reactor/core/publisher/Flux.html#concatMap-java.util.function.Function- #### Which issue(s) this PR fixes: Fixes https://github.com/halo-dev/halo/issues/3555 #### Special notes for your reviewer: #### Does this PR introduce a user-facing change? ```release-note 修复用户列表排序不稳定问题 ``` --- .../java/run/halo/app/core/extension/endpoint/UserEndpoint.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/application/src/main/java/run/halo/app/core/extension/endpoint/UserEndpoint.java b/application/src/main/java/run/halo/app/core/extension/endpoint/UserEndpoint.java index f2988e650..88321ee8d 100644 --- a/application/src/main/java/run/halo/app/core/extension/endpoint/UserEndpoint.java +++ b/application/src/main/java/run/halo/app/core/extension/endpoint/UserEndpoint.java @@ -397,7 +397,7 @@ public class UserEndpoint implements CustomEndpoint { private Mono> toListedUser(ListResult listResult) { return Flux.fromStream(listResult.get()) - .flatMap(user -> { + .concatMap(user -> { Set roleNames = roleNames(user); return roleService.list(roleNames) .collectList()