Skip to content

Commit

Permalink
Regenerate pubsub client: Fix empty list returns (#4159)
Browse files Browse the repository at this point in the history
* Regenerate pubsub client

* Fix the default maxInboundMessageSize config via synth
  • Loading branch information
yoshi-automation authored and chingor13 committed Dec 5, 2018
1 parent 0734868 commit f3d0703
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,9 @@ public String extractNextToken(ListTopicsResponse payload) {

@Override
public Iterable<Topic> extractResources(ListTopicsResponse payload) {
return payload.getTopicsList();
return payload.getTopicsList() != null
? payload.getTopicsList()
: ImmutableList.<Topic>of();
}
};

Expand Down Expand Up @@ -332,7 +334,9 @@ public String extractNextToken(ListTopicSubscriptionsResponse payload) {

@Override
public Iterable<String> extractResources(ListTopicSubscriptionsResponse payload) {
return payload.getSubscriptionsList();
return payload.getSubscriptionsList() != null
? payload.getSubscriptionsList()
: ImmutableList.<String>of();
}
};

Expand Down Expand Up @@ -476,11 +480,6 @@ public static class Builder extends StubSettings.Builder<PublisherStubSettings,
ImmutableSet.copyOf(
Lists.<StatusCode.Code>newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
definitions.put(
"http_get",
ImmutableSet.copyOf(
Lists.<StatusCode.Code>newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
definitions.put(
"one_plus_delivery",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,9 @@ public String extractNextToken(ListSubscriptionsResponse payload) {

@Override
public Iterable<Subscription> extractResources(ListSubscriptionsResponse payload) {
return payload.getSubscriptionsList();
return payload.getSubscriptionsList() != null
? payload.getSubscriptionsList()
: ImmutableList.<Subscription>of();
}
};

Expand Down Expand Up @@ -389,7 +391,9 @@ public String extractNextToken(ListSnapshotsResponse payload) {

@Override
public Iterable<Snapshot> extractResources(ListSnapshotsResponse payload) {
return payload.getSnapshotsList();
return payload.getSnapshotsList() != null
? payload.getSnapshotsList()
: ImmutableList.<Snapshot>of();
}
};

Expand Down Expand Up @@ -484,11 +488,6 @@ public static class Builder extends StubSettings.Builder<SubscriberStubSettings,
StatusCode.Code.INTERNAL,
StatusCode.Code.RESOURCE_EXHAUSTED,
StatusCode.Code.UNAVAILABLE)));
definitions.put(
"http_get",
ImmutableSet.copyOf(
Lists.<StatusCode.Code>newArrayList(
StatusCode.Code.DEADLINE_EXCEEDED, StatusCode.Code.UNAVAILABLE)));
definitions.put("non_idempotent", ImmutableSet.copyOf(Lists.<StatusCode.Code>newArrayList()));
RETRYABLE_CODE_DEFINITIONS = definitions.build();
}
Expand Down
6 changes: 6 additions & 0 deletions google-cloud-clients/google-cloud-pubsub/synth.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,12 @@
s.copy(library / f'grpc-google-cloud-{service}-{version}/src', f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src')
s.copy(library / f'proto-google-cloud-{service}-{version}/src', f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src')

s.replace(
'**/stub/SubscriberStubSettings.java',
r'return InstantiatingGrpcChannelProvider\.newBuilder\(\);',
'return InstantiatingGrpcChannelProvider.newBuilder().setMaxInboundMessageSize(20 << 20); // 20MB'
)

java.format_code('./src')
java.format_code(f'../../google-api-grpc/grpc-google-cloud-{service}-{version}/src')
java.format_code(f'../../google-api-grpc/proto-google-cloud-{service}-{version}/src')

0 comments on commit f3d0703

Please sign in to comment.