Skip to content

Conversation

@luoling8192
Copy link

@luoling8192 luoling8192 commented Oct 31, 2025

When retrying with exponential backoff, the retry time will become 2^n times the delay.

References:
https://docs.cloud.google.com/memorystore/docs/redis/exponential-backoff
https://en.wikipedia.org/wiki/Exponential_backoff

@dosubot dosubot bot added size:XS This PR changes 0-9 lines, ignoring generated files. enhancement New feature or request labels Oct 31, 2025
@9romise
Copy link
Member

9romise commented Oct 31, 2025

I believe #5089 can achieve the same outcome that this PR is aiming for.

@luoling8192
Copy link
Author

I believe #5089 can achieve the same outcome that this PR is aiming for.

This press release is straightforward and doesn't clash with #5089. Adding an extra option could be beneficial.

Many may not know how to implement exponential backoff, but with this built-in feature, it's as simple as toggling a switch, eliminating the need for a custom anonymous function.

@dosubot dosubot bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Oct 31, 2025
@OrbisK OrbisK requested a review from 9romise October 31, 2025 12:35
@9romise
Copy link
Member

9romise commented Nov 1, 2025

I believe #5089 can achieve the same outcome that this PR is aiming for.

This press release is straightforward and doesn't clash with #5089. Adding an extra option could be beneficial.

Many may not know how to implement exponential backoff, but with this built-in feature, it's as simple as toggling a switch, eliminating the need for a custom anonymous function.

That makes sense. However, I think it would be better to either:

  1. Allow autoConnect.delay to accept a string like 'backoff', or
  2. Provide a preset backoff implementation that users can pass to the delay option.

The second approach would be more maintainable and enable better tree-shaking (despite its small size), though we'd need to wait for #5089 to be merged first. What are your thoughts?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants