Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .tool-versions
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
golang 1.24.5
golang 1.25.3
protoc 29.3
protoc-gen-go-grpc 1.3.0
golangci-lint 2.2.2
golangci-lint 2.4.0
mockery 2.53.3
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/smartcontractkit/chainlink-common

go 1.24.5
go 1.25.3

require (
github.com/Masterminds/semver/v3 v3.4.0
Expand Down
12 changes: 4 additions & 8 deletions pkg/loop/internal/net/broker.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,25 +112,21 @@ func (b *BrokerExt) Serve(name string, server *grpc.Server, deps ...Resource) (u
}

var wg sync.WaitGroup
wg.Add(1)
go func() {
defer wg.Done()
wg.Go(func() {
defer b.CloseAll(deps...)
if err := server.Serve(lis); err != nil {
b.Logger.Errorw(fmt.Sprintf("Failed to serve %s on connection %d", name, id), "err", err)
}
}()
})

done := make(chan struct{})
wg.Add(1)
go func() {
defer wg.Done()
wg.Go(func() {
select {
case <-b.StopCh:
server.Stop()
case <-done:
}
}()
})

return id, Resource{fnCloser(sync.OnceFunc(func() {
server.Stop()
Expand Down
12 changes: 4 additions & 8 deletions pkg/services/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -66,25 +66,21 @@ type Engine struct {
// defer span.End()
// })
func (e *Engine) Go(fn func(context.Context)) {
e.wg.Add(1)
go func() {
defer e.wg.Done()
e.wg.Go(func() {
ctx, cancel := e.StopChan.NewCtx()
defer cancel()
fn(ctx)
}()
})
}

// GoCtx is like Go but passes through ctx.
// Use context.WithoutCancel if the function should continue running.
func (e *Engine) GoCtx(ctx context.Context, fn func(context.Context)) {
e.wg.Add(1)
go func() {
defer e.wg.Done()
e.wg.Go(func() {
ctx, cancel := e.StopChan.Ctx(ctx)
defer cancel()
fn(ctx)
}()
})
}

// GoTick is like Go but calls fn for each tick.
Expand Down
6 changes: 2 additions & 4 deletions pkg/sqlutil/sqltest/txdb_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ func TestTxDBDriver(t *testing.T) {
t.Run("Make sure sql.Register() can be called concurrently without racing", func(t *testing.T) {
wg := sync.WaitGroup{}
for range 10 {
wg.Add(1)
go func() {
wg.Go(func() {
err := RegisterTxDB(pg.DriverInMemoryPostgres)
require.NoError(t, err)
wg.Done()
}()
})
}
wg.Wait()
drivers := sql.Drivers()
Expand Down
6 changes: 2 additions & 4 deletions pkg/types/gateway/round_robin_selector_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -72,16 +72,14 @@ func TestRoundRobinSelector_Concurrency(t *testing.T) {
results := make(chan string, numRequests)

for range numRequests {
wg.Add(1)
go func() {
defer wg.Done()
wg.Go(func() {
gw, err := rr.NextGateway()
if err != nil {
t.Errorf("unexpected error: %v", err)
return
}
results <- gw
}()
})
}

wg.Wait()
Expand Down
6 changes: 2 additions & 4 deletions pkg/utils/subprocesses.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ func (s *Subprocesses) Wait() {

// Go calls the given function in a new goroutine.
func (s *Subprocesses) Go(f func()) {
s.wg.Add(1)
go func() {
defer s.wg.Done()
s.wg.Go(func() {
f()
}()
})
}
7 changes: 2 additions & 5 deletions pkg/workflows/wasm/host/module.go
Original file line number Diff line number Diff line change
Expand Up @@ -404,10 +404,7 @@ func linkLegacyDAG(m *module, store *wasmtime.Store, exec *execution[*wasmdagpb.
}

func (m *module) Start() {
m.wg.Add(1)
go func() {
defer m.wg.Done()

m.wg.Go(func() {
ticker := time.NewTicker(m.cfg.TickInterval)
for {
select {
Expand All @@ -417,7 +414,7 @@ func (m *module) Start() {
m.engine.IncrementEpoch()
}
}
}()
})
}

func (m *module) Close() {
Expand Down
Loading