Skip to content

Commit

Permalink
chore: coderabbit
Browse files Browse the repository at this point in the history
  • Loading branch information
gfyrag committed Jan 30, 2025
1 parent 0da77e0 commit e586965
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
3 changes: 1 addition & 2 deletions internal/leadership/broadcaster.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ type listener struct {
}

type Broadcaster struct {
mu *sync.Mutex
mu sync.Mutex
t *Leadership

inner []listener
Expand Down Expand Up @@ -81,6 +81,5 @@ func (h *Broadcaster) CountListeners() int {
func NewSignal() *Broadcaster {
return &Broadcaster{
outer: make(chan Leadership),
mu: &sync.Mutex{},
}
}
7 changes: 7 additions & 0 deletions internal/leadership/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,13 @@ func TestLeaderShip(t *testing.T) {
}
return false
}, 2*time.Second, 10*time.Millisecond)
leaderCount := 0
for _, manager := range instances {
if manager.GetSignal().Actual().Acquired {
leaderCount++
}
}
require.Equal(t, 1, leaderCount)
require.GreaterOrEqual(t, selectedLeader, 0)

// ensure the provided db connection is still functionnal
Expand Down

0 comments on commit e586965

Please sign in to comment.