@@ -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