diff options
author | Vitaly Takmazov | 2024-02-01 15:19:49 +0300 |
---|---|---|
committer | Vitaly Takmazov | 2024-02-01 15:20:02 +0300 |
commit | 3cf580867600494615a7bdc9ab43ef0735d5aedb (patch) | |
tree | b67827eb4485a9a4a72292e21d75da2e3602aff3 | |
parent | 23ea57f6436ed72881a369599c61ab655b03c23b (diff) |
Do not block JDBC connection to get message tags
-rw-r--r-- | src/main/java/com/juick/service/MessagesServiceImpl.java | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/src/main/java/com/juick/service/MessagesServiceImpl.java b/src/main/java/com/juick/service/MessagesServiceImpl.java index 8292f4fd..6874c7bc 100644 --- a/src/main/java/com/juick/service/MessagesServiceImpl.java +++ b/src/main/java/com/juick/service/MessagesServiceImpl.java @@ -92,10 +92,6 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ msg.setReplies(rs.getInt(10)); msg.setAttachmentType(rs.getString(11)); msg.Hidden = rs.getBoolean(13); - if (msg.getRid() == 0) { - msg.setTags(tagService.getMessageTags(msg.getMid()).stream() - .map(TagStats::getTag).collect(Collectors.toSet())); - } msg.setRepliesBy(rs.getString(15)); msg.setText(rs.getString(16)); msg.setReplyQuote(MessageUtils.formatQuote(rs.getString(17))); @@ -822,6 +818,9 @@ public class MessagesServiceImpl extends BaseJdbcService implements MessagesServ List<Message> msgs = getNamedParameterJdbcTemplate().query(query, new MapSqlParameterSource("ids", mids) .addValue("uid", uid), messageMapper); + + msgs.forEach(m -> m.setTags(tagService.getMessageTags(m.getMid()).stream() + .map(TagStats::getTag).collect(Collectors.toSet()))); Map<Integer, Set<Reaction>> likes = updateReactionsFor(mids); msgs.forEach(i -> i.setReactions(likes.get(i.getMid()))); msgs.sort(Comparator.comparing(item -> mids.indexOf(item.getMid()))); |