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 b195cc0
Show file tree
Hide file tree
Showing 20 changed files with 11 additions and 56 deletions.
3 changes: 0 additions & 3 deletions internal/api/bulking/mocks_ledger_controller_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions internal/api/common/mocks_ledger_controller_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions internal/api/common/mocks_system_controller_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions internal/api/v1/mocks_ledger_controller_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions internal/api/v1/mocks_system_controller_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions internal/api/v2/mocks_ledger_controller_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions internal/api/v2/mocks_system_controller_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions internal/controller/ledger/controller_generated_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions internal/controller/ledger/listener_generated_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions internal/controller/ledger/numscript_parser_generated_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 0 additions & 5 deletions internal/controller/ledger/store_generated_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

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{},
}
}
4 changes: 2 additions & 2 deletions internal/leadership/context.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import (
"sync"
)

type contextKey string
type contextKey struct{}

var holderContextKey contextKey = "holder"
var holderContextKey contextKey = struct{}{}

func ContextWithLeadershipInfo(ctx context.Context) context.Context {
return context.WithValue(ctx, holderContextKey, &holder{})
Expand Down
2 changes: 1 addition & 1 deletion internal/leadership/locker.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ func (p *defaultLocker) Take(ctx context.Context) (DBHandle, error) {
var acquired bool
if err := ret.Scan(&acquired); err != nil {
_ = conn.Close()
panic(err)
return nil, err
}

Check warning on line 42 in internal/leadership/locker.go

View check run for this annotation

Codecov / codecov/patch

internal/leadership/locker.go#L40-L42

Added lines #L40 - L42 were not covered by tests

if !acquired {
Expand Down
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
4 changes: 0 additions & 4 deletions internal/storage/driver/buckets_generated_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions internal/storage/driver/ledger_generated_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions internal/storage/driver/system_generated_test.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit b195cc0

Please sign in to comment.