Skip to content

pubsub subscription delete hanging in 0.34 #1343

@fondberg

Description

@fondberg

I'm trying to delete the subscription before exiting my service but it hangs forever.
I didn't see any way of turning on debug so I am not sure what requests and responses are sent.
The subscription is created when subscribing so no other subscribers exists on the subscription.
Any ideas on what I can try next?

var pubsub = gcloud.pubsub({
    keyFilename: config.get('GCLOUD_APPLICATION_CREDENTIALS'),
    projectId: config.get('GCLOUD_PROJECT')
});
var topic = pubsub.topic(config.get("TOPIC_NAME"));

topic.subscribe(config.get("SUBSCRIPTION_NAME"), {
    autoAck: true,
    reuseExisting: true
}, function(err, sub) {
    if (err) {
        return cb(err);
    }
    subscription = sub;
    // Listen to and handle message and error events
    subscription.on('message', handleMessage);
    subscription.on('error', handleError);

    console.log('Listening to ' + config.get("TOPIC_NAME") +
        ' with subscription ' + config.get("SUBSCRIPTION_NAME"));
});

function handleMessage(message) {
    console.log("Got pubsub message:\n", message.data);
}

function handleError(err) {
    console.error(err);
}


function unsubscribe() {
  if (subscription) {
    // Remove event listeners
    console.log("Deleting subscription: ", subscription.name);
    subscription.delete(function(err, apiResponse) {
      console.log("In delete subscription got:", err, apiResponse);
    });
  }
}

When calling the unsubscribe function the callback is never called.

Metadata

Metadata

Assignees

Labels

api: pubsubIssues related to the Pub/Sub API.type: questionRequest for information or clarification. Not an issue.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions