-
I remembered that yesterday this code runs ok with no match user. But today it fails suddenly. As you can see, The code is the same with the Room findById. If no element, the room will become null and continue to work. For user, I got the NoSuchElementException. Why?
Panache.withSession(() ->
Room.<Room>findById(roomId).onItem().invoke(room -> {
if (room == null) {
try {
sharedLogger.getLogger().infof("Room %s doesn't exist", roomId);
session.close();
} catch (IOException e) {
sharedLogger.getLogger().error("Failed to close session", e);
}
return;
} else {
LiveManager.ROOM_MAP.put(roomId, new LiveRoom(sharedLogger.getLogger(), room));
}
UUID uuid = UUID.fromString(id);
User.<User>findById(uuid).onItem().invoke(user -> {
if (user == null) {
System.out.println("null");
} else {
System.out.println(user);
}
}).subscribe().with(r -> {
});
// LiveManager.onClientLogin(roomId, id, name, session, sharedLogger.getLogger());
})).subscribe().with(r -> {
}); |
Beta Was this translation helpful? Give feedback.
Answered by
SetoKaiba
Apr 3, 2023
Replies: 2 comments 7 replies
-
/cc @FroMage (panache), @loicmathieu (panache) |
Beta Was this translation helpful? Give feedback.
0 replies
-
OK, chain the Uni. Problem solved. |
Beta Was this translation helpful? Give feedback.
7 replies
Answer selected by
SetoKaiba
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
OK, chain the Uni. Problem solved.