Skip to content

Commit 2c8e6dd

Browse files
authored
fix: add backpressure to GroupBy [WriteApi] (#358)
1 parent 77fb8db commit 2c8e6dd

16 files changed

+1365
-347
lines changed

.circleci/config.yml

+7-3
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,9 @@ workflows:
225225
- tests-java:
226226
name: jdk-8-nightly
227227
influxdb-image: "quay.io/influxdb/influxdb:nightly"
228+
- tests-java:
229+
name: client-backpressure
230+
junit-tests: "-DclientBackpressure=true -Dit.test=com.influxdb.client.ITBackpressure -DfailIfNoTests=false -Dtest=ignore -DwildcardSuites=ignore"
228231
- tests-java:
229232
name: client-benchmark
230233
junit-tests: "-DclientBenchmark=true -Dit.test=com.influxdb.client.ITBenchmarkTest -DfailIfNoTests=false -Dtest=ignore -DwildcardSuites=ignore"
@@ -249,7 +252,8 @@ workflows:
249252
only:
250253
- master
251254
jobs:
252-
- tests-java
253255
- tests-java:
254-
name: jdk-11-beta
255-
maven-image: "cimg/openjdk:11.0"
256+
name: jdk-8
257+
- tests-java:
258+
name: client-backpressure
259+
junit-tests: "-DclientBackpressure=true -Dit.test=com.influxdb.client.ITBackpressure -DfailIfNoTests=false -Dtest=ignore -DwildcardSuites=ignore"

CHANGELOG.md

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,9 @@
2222
1. [#367](https://github.com/influxdata/influxdb-client-java/pull/367): Add `GatewayTimeoutException` for HTTP status code 504
2323
1. [#371](https://github.com/influxdata/influxdb-client-java/pull/371): Add possibility to customize the `User-Agent` HTTP header
2424

25+
### Bug Fixes
26+
1. [#358](https://github.com/influxdata/influxdb-client-java/pull/358): Missing backpressure for asynchronous non-blocking API
27+
2528
### CI
2629
1. [#369](https://github.com/influxdata/influxdb-client-java/pull/369): Add JDK 18 to CI pipeline
2730

client-test/src/main/java/com/influxdb/test/AbstractMockServerTest.java

+6-10
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ public abstract class AbstractMockServerTest extends AbstractTest {
4040

4141
private static final int INTERNAL_SERVER_ERROR = 500;
4242
protected MockWebServer mockServer;
43+
protected MockServerExtension mockServerExtension;
4344

4445
/**
4546
* Start Mock server.
@@ -49,21 +50,16 @@ public abstract class AbstractMockServerTest extends AbstractTest {
4950
@Nonnull
5051
protected String startMockServer() {
5152

52-
mockServer = new MockWebServer();
53-
try {
54-
mockServer.start();
55-
} catch (IOException e) {
56-
throw new RuntimeException(e);
57-
}
53+
mockServerExtension = new MockServerExtension();
54+
mockServerExtension.start();
55+
mockServer = mockServerExtension.server;
5856

59-
return mockServer.url("/").url().toString();
57+
return mockServerExtension.baseURL;
6058
}
6159

6260
@AfterEach
6361
protected void after() throws IOException {
64-
if (mockServer != null) {
65-
mockServer.shutdown();
66-
}
62+
mockServerExtension.shutdown();
6763
}
6864

6965
@Nonnull
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
/*
2+
* The MIT License
3+
*
4+
* Permission is hereby granted, free of charge, to any person obtaining a copy
5+
* of this software and associated documentation files (the "Software"), to deal
6+
* in the Software without restriction, including without limitation the rights
7+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8+
* copies of the Software, and to permit persons to whom the Software is
9+
* furnished to do so, subject to the following conditions:
10+
*
11+
* The above copyright notice and this permission notice shall be included in
12+
* all copies or substantial portions of the Software.
13+
*
14+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20+
* THE SOFTWARE.
21+
*/
22+
package com.influxdb.test;
23+
24+
import java.io.IOException;
25+
26+
import okhttp3.mockwebserver.MockWebServer;
27+
28+
public final class MockServerExtension {
29+
30+
public MockWebServer server;
31+
public String baseURL;
32+
33+
public void start() {
34+
35+
server = new MockWebServer();
36+
try {
37+
server.start();
38+
} catch (IOException e) {
39+
throw new RuntimeException(e);
40+
}
41+
42+
baseURL = server.url("/").url().toString();
43+
}
44+
45+
public void shutdown() throws IOException {
46+
if (server != null) {
47+
server.shutdown();
48+
}
49+
}
50+
}

0 commit comments

Comments
 (0)