question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

topic.setPublishOptions fails to change batching settings

See original GitHub issue

Environment details

  • OS: Linux
  • Node.js version: 12.x
  • npm version: 6.14.5
  • @google-cloud/pubsub version: 2.5.0

Steps to reproduce

  1. Create a topic
  2. Call setPublishOptions on the topic to change the batching settings
  3. Call publish or publishJSON on the topic to send a message
  4. Observe that new batching settings are not used

Probable root cause: publisher.setOptions doesn’t propagate the new batching settings to its this.queue / this.orderedQueues: https://github.com/googleapis/nodejs-pubsub/blob/master/src/publisher/index.ts#L245

Workaround: always include batching options when creating the topic object.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
feywindcommented, May 5, 2021

There’s a PR up that should take care of propagating out the new defaults. It also adds a method to return the default config, so you can edit it and then set it.

I kind of also want to make a separate PR for being able to partially update the config, but hopefully this will get everyone going.

0reactions
feywindcommented, Apr 19, 2021

I’m planning to look into this properly this week.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Publish with batching settings | Cloud Pub/Sub Documentation
Creates a publisher client with custom batching settings and uses it to publish some messages.
Read more >
@google-cloud/pubsub | Yarn - Package Manager
BREAKING: Subscription options have changed. (#388). Before const subscription = topic.subscription('my-sub', { batching: { maxMilliseconds: 100, } ...
Read more >
Batching PubSub requests - node.js - Stack Overflow
If you wanted to batch messages, then you'd need to keep hold of the publisher and call publish on it multiple times.
Read more >
https://raw.githubusercontent.com/googleapis/nodej...
... (2021-08-11) ### Bug Fixes * **pubsub:** replace IAMPolicy in API config ... Features * update publisher options all the way through the...
Read more >
Fine-tuning Pub/Sub performance with batch and flow control ...
A batch, within the context of Cloud Pub/Sub, refers to a group of one or more messages published to a topic by a...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found