I have an issue with Pubsub. I have one function and one topic. When I publish on the topic, it takes 2 minutes before publishing the message. Is that normal?
The problem is not present on local (with webstrom / Google Cloud SQK for windows). Publish time on local: 240ms Publish time on google cloud console: 2minutes
Below my code :
var topicName = "projects/XXXXXXXXXXXXXX/topics/ps_checkNiveauBacTampon";
const publisher = pubSubClient.topic(topicName, {
batching: {
maxMessages: 100,
maxMilliseconds: 1,
},
});
exports.helloPubSub = function(event, context) => {
var jsonPub = {idBassin: 1};
var payload = Buffer.from(JSON.stringify(jsonPub));
// Publishes the message as a string, e.g. "Hello, world!" or JSON.stringify(someObject)
//const dataBuffer = Buffer.from(JSON.stringify(jsonPub));
try {
console.log('In try, before publish');
const messageId = await publisher.publish(payload);
console.log('In try, after publish');
} catch (error) {
console.error(`Received error while publishing: ${error.message}`);
process.exitCode = 1;
}
console.log('After try');
}
Below the google cloud log :
maxMilliseconds
to 1 in your batching settings. – Lauren