googleapis / googleapis/google-cloud-ruby

Pub/Sub: Retries when publishing

Offen
#20,573 2 Kommentare 0 Reaktionen 0 zugewiesene Personen Auf GitHub ansehen
api: pubsub type: cleanup
Vorherrschende Sprache
Ruby
Sterne
1.4k
Forks
578
Ø Merge
1 T. 11 Std.
Gemergte PRs (30 T.)
166

Beschreibung

#### 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?

Beitragsleitfaden

Beitragsleitfaden öffnen

Rechercherichtung

Beginne damit, die Fehlerbehandlung des asynchronen Publishers rund um publish_batch_error_retryable? und PUBLISH_RETRY_ERRORS im Kontext von Ruby 3.1.2 und google-cloud-pubsub 2.15.1 nachzuverfolgen. Vergleiche das Wiederholungsverhalten mit der Dokumentation der Pub/Sub-Fehlercodes und PR 3685, und lege endliche, angemessene Wiederholungen für das Publizieren mit und ohne ordering keys fest.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Bewertung

Tech-Stack
ruby
Bereich
distributed-systems
Issue-Typ
Bug
Schwierigkeit
4/5
Geschätzter Aufwand
3-5 Tage
Aktivitätsstatus
Veraltet
Klarheit
Größtenteils klar
Anfängerfreundlichkeit
35/100

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.