From: AsamK Date: Sat, 15 Jan 2022 17:21:26 +0000 (+0100) Subject: Log the time it takes to send a group message X-Git-Tag: v0.10.1~2 X-Git-Url: https://git.nmode.ca/signal-cli/commitdiff_plain/a01d6b085aedca6974a5e2efe3b0fdd55c5718e8?ds=sidebyside Log the time it takes to send a group message --- diff --git a/lib/src/main/java/org/asamk/signal/manager/helper/SendHelper.java b/lib/src/main/java/org/asamk/signal/manager/helper/SendHelper.java index acdba555..108c3c68 100644 --- a/lib/src/main/java/org/asamk/signal/manager/helper/SendHelper.java +++ b/lib/src/main/java/org/asamk/signal/manager/helper/SendHelper.java @@ -38,6 +38,7 @@ import org.whispersystems.signalservice.api.push.exceptions.UnregisteredUserExce import org.whispersystems.signalservice.internal.push.exceptions.InvalidUnidentifiedAccessHeaderException; import java.io.IOException; +import java.time.Duration; import java.util.ArrayList; import java.util.HashSet; import java.util.List; @@ -285,6 +286,7 @@ public class SendHelper { final Set recipientIds, final DistributionId distributionId ) throws IOException { + long startTime = System.currentTimeMillis(); // isRecipientUpdate is true if we've already sent this message to some recipients in the past, otherwise false. final var isRecipientUpdate = false; Set senderKeyTargets = distributionId == null @@ -329,7 +331,8 @@ public class SendHelper { isRecipientUpdate || allResults.size() > 0); allResults.addAll(results); } - + final var duration = Duration.ofMillis(System.currentTimeMillis() - startTime); + logger.debug("Sending took {} seconds", duration.toString()); return allResults; }