googleapis / googleapis/google-cloud-ruby

Pub/Sub: Retries when publishing

Aperta
#20,573 2 commenti 0 reazioni 0 assegnatari Vedi su GitHub
api: pubsub type: cleanup
Lingua principale
Ruby
Stelle
1.4k
Fork
578
Merge medio
1g 11h
PR unite (30g)
166

Descrizione

#### Environment details

- OS: Ubuntu
- Ruby version: 3.1.2
- Gem name and version: `google-cloud-pubsub (2.15.1)`

#### Steps to reproduce

Not sure if this is a bug or intended, but two things:

1. If an error happens during publishing, using the async publisher, it is not retried unless you also supply an ordering key:
```ruby
rescue StandardError => e
items = batch.items

unless batch.ordering_key.empty?
retry if publish_batch_error_retryable? e # why are retries only done when ordering key present?
```
This was added in: https://github.com/googleapis/google-cloud-ruby/pull/3685. How come retrying in case of errors should not be done if you *don't* have an ordering key? Or is that a bug?

2. If you do have an ordering key, it will retry any of the following errors, indefinitely:
```ruby
PUBLISH_RETRY_ERRORS = [
GRPC::Cancelled, GRPC::DeadlineExceeded, GRPC::Internal,
GRPC::ResourceExhausted, GRPC::Unauthenticated, GRPC::Unavailable
].freeze
```
Consulting the documentation (https://cloud.google.com/pubsub/docs/reference/error-codes) it looks like some of these are incorrect. For instance `GRPC::Unauthenticated` should *not* be retried, and `GRPC::ResourceExhausted` should be retried with exponential backoff. It seems like it would be a problem if for instance `GRPC::Unauthenticated` keeps retrying forever?

Guida per i contributori

Apri la guida per i contributori

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.