pubsub messages take 30 seconds to publish
See original GitHub issueI’ve created a cloudfunction which transforms a xml request into json entities and then publishes the entites to pubsub one by one. The problem is that it takes around 30 seconds (sometimes more) to publish the first entity. after the first entity is published the others are published instantly. In our dataflow we depend on fast communication times which makes this a big problem for us. I already tried to disable the batching but it had the same behaviour as before. Also i tried the same thing with python in it worked without any delay.
const topic = pubsub.topic("topic", {
batching: {
maxMessages: 1
},
});
const attributes = {
operation: operation
};
jsonEntities.forEach((entity) => {
const publisher = topic.publisher;
publisher.publish(Buffer.from(JSON.stringify(entity), attributes));
});
console.log(`after ${new Date().toLocaleString()}`);
res.status(200);
Environment details
- Node.js version: 8
@google-cloud/pubsub
version: 0.28.1
Thanks!
Issue Analytics
- State:
- Created 4 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
Publish messages to topics | Cloud Pub/Sub - Google Cloud
Before you begin; Message format; Publish messages. Use attributes; Use ... By default a publisher will retry for 60 seconds, with an initial...
Read more >Cloud Function is taking too long to send a message to PubSub
The message does get published to the PubSub queue, however, it is pushed ~90 seconds after the image processing is complete.
Read more >pubsub: so slow when publish message · Issue #1961 - GitHub
Hi I am new with google pubsub, why so slow when publish message to topic? Sometime it only takes 20-30ms, but sometimes can...
Read more >pubsub - Go Packages
Package pubsub provides an easy way to publish and receive Google Cloud Pub/Sub ... For use cases where message processing exceeds 30 minutes,...
Read more >Publishing first messages takes a long time (10 to 15 seconds)!
to Google Cloud Pub/Sub Discussions. Hi when I publish messages in a loop, the first messages is published in 10 to 15 seconds,...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Oh fascinating! If the cloud function is loaded, and the library has been require’d, I don’t think we have a bug or have done any investigation here. Sounds like an adventure @callmehiphop!
if i it like that it works just fine for some reason.
I guess it’s no issue of your library. I’ll close this Issue.