Skip to content

Commit 1f1368c

Browse files
authored
---
yaml --- r: 32299 b: refs/heads/autosynth-errorreporting c: 8894854 h: refs/heads/master i: 32297: 5ddbd87 32295: 11dd7a2
1 parent 91c6b6a commit 1f1368c

2 files changed

Lines changed: 10 additions & 6 deletions

File tree

  • branches/autosynth-errorreporting/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
@@ -129,7 +129,7 @@ refs/heads/autosynth-bigtable-admin: 6379a2bc712f2736c83de0e009b4d26da4fa82ca
129129
refs/heads/autosynth-containeranalysis: 18d210f81f17cf74864d0db2c29e834302f74f2a
130130
refs/heads/autosynth-datastore: f1efc3dc465174f41041acd56cf29badcec3e5bd
131131
refs/heads/autosynth-dialogflow: 73974cc32e5212aec0126472e0bc1442886fedaf
132-
refs/heads/autosynth-errorreporting: 909d0944c96347814c3ec56cb36fbd0c14f700a1
132+
refs/heads/autosynth-errorreporting: 8894854f9bcd487769ad9f38ce441a88577a4cf3
133133
refs/heads/autosynth-firestore: 983c75e4fb1076502c8cac73ef0538bdb10884f3
134134
refs/heads/autosynth-iot: 4025d1804241e74d54950a324dc4f667aeaad4b3
135135
refs/heads/autosynth-kms: 6b65b0f34c12d141031c7288cdc01e550212d0f6

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

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -304,15 +304,18 @@ public void publishAllOutstanding() {
304304
publishOutstandingBatch(batchToSend);
305305
}
306306

307-
private void publishOutstandingBatch(final OutstandingBatch outstandingBatch) {
307+
private ApiFuture<PublishResponse> publishCall(OutstandingBatch outstandingBatch) {
308308
PublishRequest.Builder publishRequest = PublishRequest.newBuilder();
309309
publishRequest.setTopic(topicName);
310310
for (OutstandingPublish outstandingPublish : outstandingBatch.outstandingPublishes) {
311311
publishRequest.addMessages(outstandingPublish.message);
312312
}
313313

314-
ApiFutures.addCallback(
315-
publisherStub.publishCallable().futureCall(publishRequest.build()),
314+
return publisherStub.publishCallable().futureCall(publishRequest.build());
315+
}
316+
317+
private void publishOutstandingBatch(final OutstandingBatch outstandingBatch) {
318+
ApiFutureCallback<PublishResponse> futureCallback =
316319
new ApiFutureCallback<PublishResponse>() {
317320
@Override
318321
public void onSuccess(PublishResponse result) {
@@ -351,8 +354,9 @@ public void onFailure(Throwable t) {
351354
messagesWaiter.incrementPendingMessages(-outstandingBatch.size());
352355
}
353356
}
354-
},
355-
directExecutor());
357+
};
358+
359+
ApiFutures.addCallback(publishCall(outstandingBatch), futureCallback, directExecutor());
356360
}
357361

358362
private static final class OutstandingBatch {

0 commit comments

Comments
 (0)