Skip to content

Commit

Permalink
fix: adding an explicit check to prevent empty publishes (#1376)
Browse files Browse the repository at this point in the history
* fix: adding an explicit check to prevent empty publishes

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
  • Loading branch information
mmicatka and gcf-owl-bot[bot] authored Oct 28, 2022
1 parent 70df54c commit 689d7da
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -58,13 +58,13 @@ implementation 'com.google.cloud:google-cloud-pubsub'
If you are using Gradle without BOM, add this to your dependencies:

```Groovy
implementation 'com.google.cloud:google-cloud-pubsub:1.120.22'
implementation 'com.google.cloud:google-cloud-pubsub:1.120.23'
```

If you are using SBT, add this to your dependencies:

```Scala
libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.120.22"
libraryDependencies += "com.google.cloud" % "google-cloud-pubsub" % "1.120.23"
```

## Authentication
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -462,6 +462,10 @@ private ApiFuture<PublishResponse> publishCall(OutstandingBatch outstandingBatch
}

private void publishOutstandingBatch(final OutstandingBatch outstandingBatch) {
if (outstandingBatch.size() == 0) {
logger.log(Level.WARNING, "Attempted to publish batch with zero messages.");
return;
}
final ApiFutureCallback<PublishResponse> futureCallback =
new ApiFutureCallback<PublishResponse>() {
@Override
Expand Down

0 comments on commit 689d7da

Please sign in to comment.