Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Subscription dies when out of messages. #461

Closed
theacodes opened this issue Mar 23, 2015 · 4 comments
Closed

Subscription dies when out of messages. #461

theacodes opened this issue Mar 23, 2015 · 4 comments
Assignees
Labels
api: pubsub Issues related to the Pub/Sub API. 🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Milestone

Comments

@theacodes
Copy link

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;
  });
@jaredrhine
Copy link

Hi, @jonparrott . Are you using auto-ack? If so, a fix is available in #455.

@theacodes
Copy link
Author

Not using autoAck.

@tmatsuo
Copy link
Contributor

tmatsuo commented Mar 25, 2015

This behavior should have been changed with the Cloud Pub/Sub API v1beta2. @jonparrott do you know which API version you're using?

@theacodes
Copy link
Author

I was using the version in npm, I tried this out with the master branch here and it doesn't seem to still be an issue. Closing.

@jgeewax jgeewax added type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns. api: pubsub Issues related to the Pub/Sub API. labels May 14, 2015
@jgeewax jgeewax added this to the Pub/Sub Beta milestone May 14, 2015
@yoshi-automation yoshi-automation added triage me I really want to be triaged. 🚨 This issue needs some love. labels Apr 6, 2020
sofisl pushed a commit that referenced this issue Sep 15, 2022
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/7de5fca1-c450-46ed-b4bd-ed0a7f991ee4/targets

- [ ] To automatically regenerate this PR, check this box.

PiperOrigin-RevId: 361273630
Source-Link: googleapis/googleapis@5477122
sofisl pushed a commit that referenced this issue Oct 11, 2022
sofisl pushed a commit that referenced this issue Oct 13, 2022
sofisl pushed a commit that referenced this issue Nov 10, 2022
sofisl pushed a commit that referenced this issue Nov 10, 2022
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/0d0efc4e-9ccd-472b-a303-4bbf020fc2e0/targets

- [ ] To automatically regenerate this PR, check this box.

Source-Link: googleapis/synthtool@ba9918c
sofisl pushed a commit that referenced this issue Nov 10, 2022
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
sofisl pushed a commit that referenced this issue Nov 11, 2022
sofisl pushed a commit that referenced this issue Nov 11, 2022
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
sofisl pushed a commit that referenced this issue Nov 11, 2022
* fix(deps): update dependency protobufjs to v7

* fix(deps): do not depend on protobufjs

Co-authored-by: Alexander Fenster <github@fenster.name>
sofisl pushed a commit that referenced this issue Nov 17, 2022
This PR was generated using Autosynth. 🌈

Synth log will be available here:
https://source.cloud.google.com/results/invocations/cc99acfa-05b8-434b-9500-2f6faf2eaa02/targets

- [ ] To automatically regenerate this PR, check this box.

Source-Link: googleapis/synthtool@799d8e6
sofisl pushed a commit that referenced this issue Nov 18, 2022
…splay_name" (#461)

- [ ] Regenerate this pull request now.

docs: Update documentation for the Mute fields on Findings

PiperOrigin-RevId: 429148908

Source-Link: googleapis/googleapis@c93764c

Source-Link: googleapis/googleapis-gen@8810468
Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiODgxMDQ2ODhmZmYzN2M2N2ZmNzJhZGRiNzNmM2ZlNjFkMTlkYzg1YSJ9
sofisl pushed a commit that referenced this issue Jan 26, 2023
* chore(main): release 2.4.0

* 🦉 Updates from OwlBot post-processor

See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md

Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Co-authored-by: Owl Bot <gcf-owl-bot[bot]@users.noreply.github.com>
sofisl pushed a commit that referenced this issue Sep 13, 2023
Co-authored-by: release-please[bot] <55107282+release-please[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsub Issues related to the Pub/Sub API. 🚨 This issue needs some love. triage me I really want to be triaged. type: bug Error or flaw in code with unintended results or allowing sub-optimal usage patterns.
Projects
None yet
Development

No branches or pull requests

5 participants