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

Title: Implement Distributed Circuit Breaker (#70) #73

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

YoshiyukiMineo
Copy link
Member

  • feature/redis-circuit-breaker

  • feature/redis-circuit-breaker

  • Refactor

  • save state

  • Saving half-open state also

  • Saving half-open state also

  • Added test case

  • Saving state transition

  • Pass context

  • Moved redis circuit breaker to v2

  • Revert go.mod and go.sum

  • Acked review comments

  • Refactor

  • Refactor


call-stack and others added 6 commits November 15, 2024 08:56
* feature/redis-circuit-breaker

* feature/redis-circuit-breaker

* Refactor

* save state

* Saving half-open state also

* Saving half-open state also

* Added test case

* Saving state transition

* Pass context

* Moved redis circuit breaker to v2

* Revert go.mod and go.sum

* Acked review comments

* Refactor

* Refactor

---------

Co-authored-by: Kalpit Pant <[email protected]>
Comment on lines +17 to +20
type SharedStateStore interface {
GetState(ctx context.Context) (SharedState, error)
SetState(ctx context.Context, state SharedState) error
}
Copy link

@call-stack call-stack Nov 20, 2024

Choose a reason for hiding this comment

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

How will implementations of this interface know which circuit breaker's state to get/set without an identifier? In a distributed system, we'd likely have multiple circuit breakers running simultaneously.

Should we consider adding a name parameter to distinguish between different circuit breakers?

Additionally, Should we decouple SharedState from the storage interface?
Current interface tightly couples the storage implementation to our SharedState struct:
What if we made this more generic? For example:

GetState(ctx context.Context, name string) ([]byte, error)
SetState(ctx context.Context, name string, data []byte) error

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants