-
Notifications
You must be signed in to change notification settings - Fork 639
Closed
Labels
🚨This issue needs some love.This issue needs some love.api: pubsubIssues related to the Pub/Sub API.Issues related to the Pub/Sub API.triage meI really want to be triaged.I really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Milestone
Description
When using topic.subscription to listen to messages via pull, the subscription will (eventually) trigger an error when there are no messages. However, the desired behavior seems to be to just keep trying until messages come in. It appears it's sufficient to just ignore the error for this to continue to work as expected. See example:
var subscription = topic.subscription(subscriptionName);
subscription.on('error', function(err) {
/* This error occurs when there's no new messages.
Since we want to listen forever, this is a non-error. */
if (err.code == 400 && err.errors[0].reason == 'failedPrecondition') return;
/* 404 means that the subscription hasn't been created. */
if (err.code == 404) logging.error("Pub/sub subscription does not exist.");
throw err;
});Metadata
Metadata
Assignees
Labels
🚨This issue needs some love.This issue needs some love.api: pubsubIssues related to the Pub/Sub API.Issues related to the Pub/Sub API.triage meI really want to be triaged.I really want to be triaged.type: bugError or flaw in code with unintended results or allowing sub-optimal usage patterns.Error or flaw in code with unintended results or allowing sub-optimal usage patterns.