googleapis / nodejs-pubsub

Node.js client for Google Cloud Pub/Sub: Ingest event streams from anywhere, at any scale, for simple, reliable, real-time stream analytics.
https://cloud.google.com/pubsub/
Apache License 2.0
516 stars 227 forks source link

Improve retry docs. How to just enable retry with default values? #1907

Closed AkselAllas closed 2 months ago

AkselAllas commented 3 months ago

This retry sample docs has us "overwriting" default values.

How can I just enable retry without overwriting?

E.g. shouldn't we be using something like this in order to refrain from violating DRY?

import { Status } from 'google-gax'

const retrySettings = {
  retryCodes: [
    Status.ABORTED,
    Status.CANCELLED,
    Status.DEADLINE_EXCEEDED,
    Status.INTERNAL,
    Status.RESOURCE_EXHAUSTED,
    Status.UNAVAILABLE,
    Status.UNKNOWN,
  ],

And something similar for Backoff settings?

@feywind? 🤔

hongalex commented 2 months ago

Retry and backoff is enabled by default, defaults here: https://github.com/googleapis/nodejs-pubsub/blob/aba9aee0c8ecc840c150aa077892b7bb88f18eca/src/v1/publisher_client_config.json#L56