Browse Source

En cours de développement

master
losyme 4 months ago
parent
commit
42dd8e90d6
  1. 4
      breaker.go
  2. 11
      config.go

4
breaker.go

@ -55,8 +55,8 @@ func (b *Breaker) execute(fn func()) State {
fn()
if b.state != previous && b.config.CbOSC != nil {
b.config.CbOSC(previous, b.state)
if b.state != previous && b.config.OnStateChange != nil {
b.config.OnStateChange(previous, b.state)
}
return b.state

11
config.go

@ -19,13 +19,10 @@ type State string
type OnStateChange func(from, to State)
type Config struct {
// Closed To Open
CToO uint
// Half-Open To Closed
HOToC uint
// Open To Half-Open
OToHO time.Duration
CbOSC OnStateChange
CToO uint // Closed To Open
HOToC uint // Half-Open To Closed
OToHO time.Duration // Open To Half-Open
OnStateChange OnStateChange
}
func DefaultConfig() *Config {

Loading…
Cancel
Save