Skip to content
Draft
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
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.26.4
go 1.27rc2

require (
github.com/Masterminds/semver/v3 v3.4.0
Expand Down
13 changes: 13 additions & 0 deletions pkg/services/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,19 @@ func (e *Engine) GoTick(ticker *timeutil.Ticker, fn func(context.Context)) {
})
}

func (e *Engine) GoRecv[C any, CH ~<-chan C](ch CH, fn func(C)) {
e.Go(func(ctx context.Context) {
for {
select {
case <-ctx.Done():
return
case c := <-ch:
fn(c)
}
}
})
}

// Tracer returns the otel tracer with service attributes included.
func (e *Engine) Tracer() trace.Tracer {
return e.tracer
Expand Down
Loading