Skip to content

Commit ad1da67

Browse files
committed
---
yaml --- r: 27257 b: refs/heads/pubsub-ordering-keys c: c90b83c h: refs/heads/master i: 27255: 223267a
1 parent ab33d51 commit ad1da67

2 files changed

Lines changed: 12 additions & 12 deletions

File tree

  • branches/pubsub-ordering-keys/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
@@ -155,7 +155,7 @@ refs/tags/v0.72.0: a7703f2593ba312c0b2dde6fdfd4f5c764bb55ac
155155
refs/tags/v0.73.0: 21241ea8be9439cc5764c4944cdce21d34ce4f9e
156156
refs/tags/v0.74.0: 9d1f733dbbf790de7b494418523b69c4a9a57638
157157
refs/heads/ignoretest: 23c412ae07af3d0ab1caa2d44d5bc5c0ccb8b31d
158-
refs/heads/pubsub-ordering-keys: 02e06aefcce3479ad5f74532ab979f8ce332d740
158+
refs/heads/pubsub-ordering-keys: c90b83c7810351b9f8c050d76d7cbf0aaed1446a
159159
"refs/heads/update_mvn_badge": ae2d773814db0f71197ccf5a8612ee1d8056f8de
160160
refs/tags/v0.75.0: c3673089ae09a897c1b4cf7dfe167fe4f8ab32fb
161161
refs/tags/v0.76.0: 395b016826d3ddf9cb8b34919636df15a4dbd032

branches/pubsub-ordering-keys/google-cloud-clients/google-cloud-pubsub/src/main/java/com/google/cloud/pubsub/v1/Publisher.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -234,30 +234,30 @@ public ApiFuture<String> publish(PubsubMessage message) {
234234
messagesBatchLock.lock();
235235
try {
236236
// Check if the next message makes the current batch exceed the max batch byte size.
237-
MessagesBatch messageBatch = messagesBatches.get(orderingKey);
238-
if (messageBatch == null) {
239-
messageBatch = new MessagesBatch(orderingKey);
240-
messagesBatches.put(orderingKey, messageBatch);
237+
MessagesBatch messagesBatch = messagesBatches.get(orderingKey);
238+
if (messagesBatch == null) {
239+
messagesBatch = new MessagesBatch(orderingKey);
240+
messagesBatches.put(orderingKey, messagesBatch);
241241
}
242-
if (!messageBatch.isEmpty()
242+
if (!messagesBatch.isEmpty()
243243
&& hasBatchingBytes()
244-
&& messageBatch.getBatchedBytes() + messageSize >= getMaxBatchBytes()) {
245-
batchToSend = messageBatch.popOutstandingBatch();
244+
&& messagesBatch.getBatchedBytes() + messageSize >= getMaxBatchBytes()) {
245+
batchToSend = messagesBatch.popOutstandingBatch();
246246
}
247247

248248
// Border case if the message to send is greater or equals to the max batch size then can't
249249
// be included in the current batch and instead sent immediately.
250250
if (!hasBatchingBytes() || messageSize < getMaxBatchBytes()) {
251-
messageBatch.addMessage(outstandingPublish, messageSize);
251+
messagesBatch.addMessage(outstandingPublish, messageSize);
252252
// If after adding the message we have reached the batch max messages then we have a batch
253253
// to send.
254-
if (messageBatch.getMessagesCount() == getBatchingSettings().getElementCountThreshold()) {
255-
batchToSend = messageBatch.popOutstandingBatch();
254+
if (messagesBatch.getMessagesCount() == getBatchingSettings().getElementCountThreshold()) {
255+
batchToSend = messagesBatch.popOutstandingBatch();
256256
}
257257
}
258258

259259
// Setup the next duration based delivery alarm if there are messages batched.
260-
if (!messageBatch.isEmpty()) {
260+
if (!messagesBatch.isEmpty()) {
261261
setupDurationBasedPublishAlarm();
262262
} else {
263263
messagesBatches.remove(orderingKey);

0 commit comments

Comments
 (0)