From 614384564482c8a35a567dd092cf5674f853ebd3 Mon Sep 17 00:00:00 2001 From: Vitaly Takmazov Date: Thu, 30 Jun 2016 11:04:41 +0300 Subject: ws debug --- src/main/java/com/juick/ws/XMPPConnection.java | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'src/main/java/com') diff --git a/src/main/java/com/juick/ws/XMPPConnection.java b/src/main/java/com/juick/ws/XMPPConnection.java index 3122e715..65008906 100644 --- a/src/main/java/com/juick/ws/XMPPConnection.java +++ b/src/main/java/com/juick/ws/XMPPConnection.java @@ -113,8 +113,10 @@ public class XMPPConnection implements Runnable, Stream.StreamListener, Message. String json = messageSerializer.serialize(jmsg).toString(); List uids = SubscriptionsQueries.getSubscribedUsers(sql, jmsg.getUser().getUID(), jmsg.getMID()) .stream().map(User::getUID).collect(Collectors.toList()); - + logger.info(String.format("%d users subscribed to %d", uids.size(), jmsg.getUser().getUID())); synchronized (ws.clients) { + Long legacycount = ws.clients.stream().filter(c -> c.legacy && c.allMessages).count(); + logger.info(String.format("%d legacy users watched %d", legacycount, jmsg.getMID())); ws.clients.stream().filter(c -> !c.legacy && uids.contains(c.visitor.getUID())).forEach(c -> { try { logger.info("sending message to " + c.visitor.getUID()); @@ -136,11 +138,14 @@ public class XMPPConnection implements Runnable, Stream.StreamListener, Message. private void onJuickMessageReply(com.juick.Message jmsg) { String json = messageSerializer.serialize(jmsg).toString(); - + logger.info("got reply: " + json); List threadUsers = SubscriptionsQueries.getUsersSubscribedToComments(sql, jmsg.getMID(), jmsg.getUser().getUID()) .stream().map(User::getUID).collect(Collectors.toList()); + logger.info(String.format("%d users subscribed to %d", threadUsers.size(), jmsg.getMID())); synchronized (ws.clients) { + Long legacycount = ws.clients.stream().filter(c -> c.legacy && c.allReplies).count(); + logger.info(String.format("%d legacy users watched %d", legacycount, jmsg.getMID())); ws.clients.stream().filter(c -> !c.legacy && threadUsers.contains(c.visitor.getUID())).forEach(c -> { try { logger.info("sending reply to " + c.visitor.getUID()); -- cgit v1.2.3