Skip to content

Commit

Permalink
fix: prevent attempt to publish 0 messages (#1218)
Browse files Browse the repository at this point in the history
  • Loading branch information
rhodgkins committed Mar 16, 2021
1 parent a4a1513 commit 96e6535
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/publisher/message-queues.ts
Expand Up @@ -74,6 +74,12 @@ export abstract class MessageQueue extends EventEmitter {
topic: topic.name,
messages,
};
if (messages.length === 0) {
if (typeof callback === 'function') {
callback(null);
}
return;
}

topic.request<google.pubsub.v1.IPublishResponse>(
{
Expand Down

0 comments on commit 96e6535

Please sign in to comment.