Skip to content

Commit

Permalink
Merge pull request #162 from yvasyliev/dev
Browse files Browse the repository at this point in the history
Increased timeout for HTTP calls
  • Loading branch information
yvasyliev authored Apr 16, 2023
2 parents 6480a4f + 72248ed commit 89325e8
Show file tree
Hide file tree
Showing 5 changed files with 15 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-maven-project.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK 8
uses: actions/setup-java@v2
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'adopt'
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,11 +38,11 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v2
uses: actions/checkout@v3

# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
uses: github/codeql-action/init@v2
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
Expand All @@ -53,7 +53,7 @@ jobs:
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
uses: github/codeql-action/autobuild@v2

# ℹ️ Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
Expand All @@ -67,4 +67,4 @@ jobs:
# make release

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1
uses: github/codeql-action/analyze@v2
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ This library uses the next third-party dependencies:
<dependency>
<groupId>com.github.yvasyliev</groupId>
<artifactId>java-vk-bots-longpoll-api</artifactId>
<version>4.1.1</version>
<version>4.1.2</version>
</dependency>
```
4. Extend `LongPollBot` class and override necessary methods:
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<groupId>com.github.yvasyliev</groupId>
<artifactId>java-vk-bots-longpoll-api</artifactId>
<packaging>jar</packaging>
<version>4.1.1</version>
<version>4.1.2</version>
<name>Java VK Bots Long Poll API</name>
<description>A Java library to create VK bots using Bots Long Poll API</description>
<url>https://github.com/yvasyliev/java-vk-bots-long-poll-api</url>
Expand Down
9 changes: 7 additions & 2 deletions src/main/java/api/longpoll/bots/methods/impl/VkMethod.java
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,11 @@ public abstract class VkMethod<VkResponse> {
*/
private static final Logger LOGGER = LoggerFactory.getLogger(VkMethod.class);

/**
* Timeout for HTTP calls.
*/
private static final int DEFAULT_TIMEOUT = 60;

/**
* Validator to check if VK API response is valid.
*/
Expand All @@ -58,8 +63,8 @@ public abstract class VkMethod<VkResponse> {
* HTTP client.
*/
private final OkHttpClient okHttpClient = new OkHttpClient.Builder()
.callTimeout(32, TimeUnit.SECONDS)
.readTimeout(32, TimeUnit.SECONDS)
.callTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS)
.readTimeout(DEFAULT_TIMEOUT, TimeUnit.SECONDS)
.addInterceptor(new LoggerInterceptor(LOGGER))
.build();

Expand Down

0 comments on commit 89325e8

Please sign in to comment.