]> nmode's Git Repositories - signal-cli/commitdiff
Reduce default receive timeout to 1 second
authorAsamK <asamk@gmx.de>
Sat, 8 May 2021 13:30:27 +0000 (15:30 +0200)
committerAsamK <asamk@gmx.de>
Sat, 8 May 2021 13:30:27 +0000 (15:30 +0200)
src/main/java/org/asamk/signal/commands/ReceiveCommand.java

index a03fc130d3889505a3769d74664f09f017825b9c..a6ef8484ef52315d1c225666a9cdce6c9a3b01e3 100644 (file)
@@ -35,6 +35,7 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
     public void attachToSubparser(final Subparser subparser) {
         subparser.addArgument("-t", "--timeout")
                 .type(double.class)
+                .setDefault(1.0)
                 .help("Number of seconds to wait for new messages (negative values disable timeout)");
         subparser.addArgument("--ignore-attachments")
                 .help("Don’t download attachments of received messages.")
@@ -148,10 +149,7 @@ public class ReceiveCommand implements ExtendedDbusCommand, LocalCommand {
             logger.warn("\"--json\" option has been deprecated, please use the global \"--output=json\" instead.");
         }
 
-        double timeout = 5;
-        if (ns.getDouble("timeout") != null) {
-            timeout = ns.getDouble("timeout");
-        }
+        double timeout = ns.getDouble("timeout");
         var returnOnTimeout = true;
         if (timeout < 0) {
             returnOnTimeout = false;