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

fix(pubsublite): improve handling of backend unavailability #3846

Merged
merged 5 commits into from Mar 25, 2021

Conversation

tmdiep
Copy link
Contributor

@tmdiep tmdiep commented Mar 22, 2021

  • Define ErrBackendUnavailable to allow users to detect and handle backend unavailability during publish and subscribe.
  • Increase settings to very high values:
    • PublishSettings.Timeout and ReceiveSettings.Timeout to 1 week.
    • PublishSettings.BufferedByteLimit to 10 GB.
  • Add examples for handling publish and subscribe errors.

@tmdiep tmdiep requested review from a team as code owners March 22, 2021 09:36
@google-cla google-cla bot added the cla: yes This human has signed the Contributor License Agreement. label Mar 22, 2021
@product-auto-label product-auto-label bot added the api: pubsublite Issues related to the Pub/Sub Lite API. label Mar 22, 2021
- define ErrBackendUnavailable
- mitigate stream initialization delays
@@ -82,7 +82,7 @@ var DefaultPublishSettings = PublishSettings{
DelayThreshold: 10 * time.Millisecond,
CountThreshold: 100,
ByteThreshold: 1e6,
Timeout: 60 * time.Minute,
Timeout: 72 * time.Hour,

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels a little arbitrary. Is there an InfiniteFuture() equivalent on Go? Same comment on the ReceiveSettings.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There isn't a defined infinite duration. It's an int64, so we can compute the max value, however I wanted to avoid depending on implementation details.

I changed this to 1 week, as it would be concerning if a client wasn't able to connect within that time. The original 3 days was to allow clients to cover a weekend.

pubsublite/internal/wire/rpc.go Show resolved Hide resolved
pubsublite/internal/wire/streams.go Outdated Show resolved Hide resolved
pubsublite/internal/wire/streams.go Outdated Show resolved Hide resolved
@tmdiep tmdiep merged commit db31457 into googleapis:master Mar 25, 2021
@tmdiep tmdiep deleted the unavailable_error branch March 25, 2021 22:50
@tmdiep tmdiep restored the unavailable_error branch June 26, 2021 20:15
@tmdiep tmdiep deleted the unavailable_error branch June 28, 2021 22:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
api: pubsublite Issues related to the Pub/Sub Lite API. cla: yes This human has signed the Contributor License Agreement.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants