aboutsummaryrefslogtreecommitdiff
path: root/juick-api/src/main/java
diff options
context:
space:
mode:
Diffstat (limited to 'juick-api/src/main/java')
-rw-r--r--juick-api/src/main/java/com/juick/api/TGBot.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/juick-api/src/main/java/com/juick/api/TGBot.java b/juick-api/src/main/java/com/juick/api/TGBot.java
index d532b02c..bbfed259 100644
--- a/juick-api/src/main/java/com/juick/api/TGBot.java
+++ b/juick-api/src/main/java/com/juick/api/TGBot.java
@@ -24,6 +24,8 @@ import javax.inject.Inject;
import java.io.IOException;
import java.util.List;
import java.util.Map;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
import static com.juick.formatters.PlainTextFormatter.formatPost;
import static com.juick.formatters.PlainTextFormatter.formatUrl;
@@ -43,6 +45,8 @@ public class TGBot implements AutoCloseable {
@Inject
MessagesService messagesService;
+ ExecutorService service = Executors.newSingleThreadExecutor();
+
private TGBot() {
throw new IllegalStateException();
}
@@ -102,7 +106,7 @@ public class TGBot implements AutoCloseable {
}
}
});
- ws.connect();
+ service.submit(() -> ws.connect());
} catch (Exception e) {
logger.warn("couldn't initialize telegram bot", e);
}