Skip to content

Commit

Permalink
Fix subscribeTopic with end time in the past not retrieving more than…
Browse files Browse the repository at this point in the history
… page size (#531)

* Fix subscribeTopic with end time in the past not retrieving more than page size

Signed-off-by: Steven Sheehy <[email protected]>

* Tweak tests

Signed-off-by: Steven Sheehy <[email protected]>

* Bump version to v0.5.5

Signed-off-by: Steven Sheehy <[email protected]>

* Upgraded to 0.8.2 r2dbc version for improved stability and bug fixes

Signed-off-by: Nana-EC <[email protected]>

Co-authored-by: Nana-EC <[email protected]>
  • Loading branch information
steven-sheehy and Nana-EC authored Feb 14, 2020
1 parent a08c192 commit 78852d2
Show file tree
Hide file tree
Showing 12 changed files with 62 additions and 14 deletions.
2 changes: 1 addition & 1 deletion hedera-mirror-coverage/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>com.hedera</groupId>
<artifactId>hedera-mirror-node</artifactId>
<version>0.5.4</version>
<version>0.5.5</version>
</parent>

<dependencies>
Expand Down
2 changes: 1 addition & 1 deletion hedera-mirror-datagenerator/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>com.hedera</groupId>
<artifactId>hedera-mirror-node</artifactId>
<version>0.5.4</version>
<version>0.5.5</version>
</parent>

<dependencies>
Expand Down
19 changes: 18 additions & 1 deletion hedera-mirror-grpc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>com.hedera</groupId>
<artifactId>hedera-mirror-node</artifactId>
<version>0.5.4</version>
<version>0.5.5</version>
</parent>

<dependencies>
Expand Down Expand Up @@ -40,10 +40,12 @@
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-pool</artifactId>
<version>0.8.2.BUILD-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-postgresql</artifactId>
<version>0.8.2.BUILD-SNAPSHOT</version>
</dependency>
<dependency>
<groupId>javax.inject</groupId>
Expand Down Expand Up @@ -161,6 +163,13 @@

<dependencyManagement>
<dependencies>
<dependency>
<groupId>io.r2dbc</groupId>
<artifactId>r2dbc-bom</artifactId>
<version>Arabba-SR2</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot.experimental</groupId>
<artifactId>spring-boot-bom-r2dbc</artifactId>
Expand Down Expand Up @@ -220,4 +229,12 @@
</plugin>
</plugins>
</build>

<repositories>
<repository>
<id>spring-libs-snapshot</id>
<name>SpringSnapshotRepository</name>
<url>https://repo.spring.io/libs-snapshot</url>
</repository>
</repositories>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ public Flux<TopicMessage> subscribeTopic(TopicMessageFilter filter) {
}

private Flux<TopicMessage> incomingMessages(TopicContext topicContext) {
if (!topicContext.shouldListen()) {
return Flux.empty();
}
// if (!topicContext.shouldListen()) {
// return Flux.empty();
// }

TopicMessageFilter filter = topicContext.getFilter();
TopicMessage last = topicContext.getLastTopicMessage();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
import reactor.test.StepVerifier;

import com.hedera.mirror.grpc.GrpcIntegrationTest;
import com.hedera.mirror.grpc.GrpcProperties;
import com.hedera.mirror.grpc.domain.DomainBuilder;
import com.hedera.mirror.grpc.domain.TopicMessage;
import com.hedera.mirror.grpc.domain.TopicMessageFilter;
Expand All @@ -48,6 +49,9 @@ public class TopicMessageServiceTest extends GrpcIntegrationTest {
@Resource
private DomainBuilder domainBuilder;

@Resource
private GrpcProperties grpcProperties;

@Test
void invalidFilter() {
TopicMessageFilter filter = TopicMessageFilter.builder()
Expand Down Expand Up @@ -150,7 +154,34 @@ void historicalMessagesWithEndTime() {
.expectNext(topicMessage1)
.expectNext(topicMessage2)
.expectNext(topicMessage3)
.verifyComplete();
.thenCancel()
.verify(Duration.ofMillis(500));
}

@Test
void historicalMessagesWithEndTimeExceedsPageSize() {
int oldMaxPageSize = grpcProperties.getMaxPageSize();
grpcProperties.setMaxPageSize(1);

TopicMessage topicMessage1 = domainBuilder.topicMessage().block();
TopicMessage topicMessage2 = domainBuilder.topicMessage().block();
TopicMessage topicMessage3 = domainBuilder.topicMessage().block();
TopicMessage topicMessage4 = domainBuilder.topicMessage().block();

TopicMessageFilter filter = TopicMessageFilter.builder()
.startTime(Instant.EPOCH)
.endTime(topicMessage4.getConsensusTimestamp())
.build();

topicMessageService.subscribeTopic(filter)
.as(StepVerifier::create)
.expectNext(topicMessage1)
.expectNext(topicMessage2)
.expectNext(topicMessage3)
.thenCancel()
.verify(Duration.ofMillis(500));

grpcProperties.setMaxPageSize(oldMaxPageSize);
}

@Test
Expand Down
2 changes: 1 addition & 1 deletion hedera-mirror-importer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<parent>
<groupId>com.hedera</groupId>
<artifactId>hedera-mirror-node</artifactId>
<version>0.5.4</version>
<version>0.5.5</version>
</parent>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion hedera-mirror-protobuf/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>com.hedera</groupId>
<artifactId>hedera-mirror-node</artifactId>
<version>0.5.4</version>
<version>0.5.5</version>
</parent>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion hedera-mirror-rest/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion hedera-mirror-rest/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "hedera-mirror-rest",
"version": "0.5.4",
"version": "0.5.5",
"description": "Hedera Mirror Node REST API",
"main": "server.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion hedera-mirror-rest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<parent>
<groupId>com.hedera</groupId>
<artifactId>hedera-mirror-node</artifactId>
<version>0.5.4</version>
<version>0.5.5</version>
</parent>

<build>
Expand Down
2 changes: 1 addition & 1 deletion hedera-mirror-test/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
<parent>
<artifactId>hedera-mirror-node</artifactId>
<groupId>com.hedera</groupId>
<version>0.5.4</version>
<version>0.5.5</version>
</parent>

<properties>
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

<groupId>com.hedera</groupId>
<artifactId>hedera-mirror-node</artifactId>
<version>0.5.4</version>
<version>0.5.5</version>
<description>Hedera Mirror Node mirrors data from Hedera nodes and serves it via an API</description>
<inceptionYear>2019</inceptionYear>
<modelVersion>4.0.0</modelVersion>
Expand Down

0 comments on commit 78852d2

Please sign in to comment.