Skip to content

Commit f231ce9

Browse files
authored
---
yaml --- r: 32757 b: refs/heads/autosynth-iot c: d2f0bc6 h: refs/heads/master i: 32755: 7cd9967
1 parent e6e6b35 commit f231ce9

2 files changed

Lines changed: 16 additions & 8 deletions

File tree

  • branches/autosynth-iot/google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,7 @@ refs/heads/autosynth-datastore: f1efc3dc465174f41041acd56cf29badcec3e5bd
131131
refs/heads/autosynth-dialogflow: 73974cc32e5212aec0126472e0bc1442886fedaf
132132
refs/heads/autosynth-errorreporting: effe8001d110ad584187b30aafc473db0dd4a15f
133133
refs/heads/autosynth-firestore: e79eeb26930dfae4439424ad2fda5874eeca54c8
134-
refs/heads/autosynth-iot: ff068a98c01b31c9cd416ff92e71c96ababcd204
134+
refs/heads/autosynth-iot: d2f0bc64a53049040fe9c9d338b12fab3dd1ad6a
135135
refs/heads/autosynth-kms: 6b65b0f34c12d141031c7288cdc01e550212d0f6
136136
refs/heads/autosynth-language: e73905aa7672afa47240e65b25c087207f4594f9
137137
refs/heads/autosynth-os-login: 123ba209c5769d0ee067e0ce5848bec13b42a4f4

branches/autosynth-iot/google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Publisher.java

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -272,13 +272,13 @@ public void publishAllOutstanding() {
272272
}
273273

274274
private ApiFuture<PublishResponse> publishCall(OutstandingBatch outstandingBatch) {
275-
PublishRequest.Builder publishRequest = PublishRequest.newBuilder();
276-
publishRequest.setTopic(topicName);
277-
for (OutstandingPublish outstandingPublish : outstandingBatch.outstandingPublishes) {
278-
publishRequest.addMessages(outstandingPublish.message);
279-
}
280-
281-
return publisherStub.publishCallable().futureCall(publishRequest.build());
275+
return publisherStub
276+
.publishCallable()
277+
.futureCall(
278+
PublishRequest.newBuilder()
279+
.setTopic(topicName)
280+
.addAllMessages(outstandingBatch.getMessages())
281+
.build());
282282
}
283283

284284
private void publishOutstandingBatch(final OutstandingBatch outstandingBatch) {
@@ -342,6 +342,14 @@ private static final class OutstandingBatch {
342342
int size() {
343343
return outstandingPublishes.size();
344344
}
345+
346+
private List<PubsubMessage> getMessages() {
347+
List<PubsubMessage> results = new ArrayList<>(outstandingPublishes.size());
348+
for (OutstandingPublish outstandingPublish : outstandingPublishes) {
349+
results.add(outstandingPublish.message);
350+
}
351+
return results;
352+
}
345353
}
346354

347355
private static final class OutstandingPublish {

0 commit comments

Comments
 (0)