Skip to content

Commit

Permalink
chore: remove SDK *toPtr methods
Browse files Browse the repository at this point in the history
Signed-off-by: Valery Piashchynski <[email protected]>
  • Loading branch information
rustatian committed Aug 23, 2023
1 parent 214b941 commit 004fb66
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
2 changes: 0 additions & 2 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ require (
github.com/roadrunner-server/api/v4 v4.6.2
github.com/roadrunner-server/endure/v2 v2.4.2
github.com/roadrunner-server/errors v1.3.0
github.com/roadrunner-server/sdk/v4 v4.4.0-beta.8
go.opentelemetry.io/contrib/propagators/jaeger v1.17.0
go.opentelemetry.io/otel v1.16.0
go.opentelemetry.io/otel/sdk v1.16.0
Expand All @@ -20,7 +19,6 @@ require (
require (
github.com/go-logr/logr v1.2.4 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/roadrunner-server/tcplisten v1.4.0 // indirect
go.opentelemetry.io/otel/metric v1.16.0 // indirect
go.uber.org/multierr v1.11.0 // indirect
golang.org/x/sys v0.11.0 // indirect
Expand Down
4 changes: 0 additions & 4 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,6 @@ github.com/roadrunner-server/endure/v2 v2.4.2 h1:aFnPc321l5HDzE2mN5wwfksJ40lgXwf
github.com/roadrunner-server/endure/v2 v2.4.2/go.mod h1:vWTvn6NiYxUBDgwAyjv92i/qFemSUs+cTItMZvc5Zsk=
github.com/roadrunner-server/errors v1.3.0 h1:kLVXpXne0jMReN7pj8KIhyYyjqKjsPC5DRGqMsd4/Fo=
github.com/roadrunner-server/errors v1.3.0/go.mod h1:XYVuhXvxi3yQaP/zCLB6QRZ0JvQIRaBa0SKFHL4WLKg=
github.com/roadrunner-server/sdk/v4 v4.4.0-beta.8 h1:8N/hwwGxCCb/B66We+iVysglZxKjABZEsX36RzlLFb8=
github.com/roadrunner-server/sdk/v4 v4.4.0-beta.8/go.mod h1:zqOvxT0uVhLHiK7HIEKWzSUDqtfTjnpyVNXZUikVLvk=
github.com/roadrunner-server/tcplisten v1.4.0 h1:yWo09zktv/CSV6VywLfw4pwNcUchgTiIrW4uIICtO5M=
github.com/roadrunner-server/tcplisten v1.4.0/go.mod h1:A6+VSnW2ETGnN/e/CMdP63ZXqQDaC0UDMU6QmyuB0yM=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
go.opentelemetry.io/contrib/propagators/jaeger v1.17.0 h1:Zbpbmwav32Ea5jSotpmkWEl3a6Xvd4tw/3xxGO1i05Y=
Expand Down
17 changes: 10 additions & 7 deletions memoryjobs/driver.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ import (

"github.com/roadrunner-server/api/v4/plugins/v2/jobs"
"github.com/roadrunner-server/errors"
"github.com/roadrunner-server/sdk/v4/utils"
jprop "go.opentelemetry.io/contrib/propagators/jaeger"
"go.opentelemetry.io/otel"
"go.opentelemetry.io/otel/propagation"
Expand Down Expand Up @@ -90,8 +89,8 @@ func FromConfig(
log: log,
pq: pq,
goroutines: 0,
msgInFlight: utils.Int64(0),
delayed: utils.Int64(0),
msgInFlight: toPtr(int64(0)),
delayed: toPtr(int64(0)),
stopCh: make(chan struct{}),
}

Expand All @@ -108,7 +107,7 @@ func FromConfig(
jb.cfg.Prefetch = 100_000
}

jb.msgInFlightLimit = utils.Int64(jb.cfg.Prefetch)
jb.msgInFlightLimit = toPtr(jb.cfg.Prefetch)

if jb.cfg.Priority == 0 {
jb.cfg.Priority = 10
Expand Down Expand Up @@ -149,9 +148,9 @@ func FromPipeline(
cond: sync.Cond{L: &sync.Mutex{}},
localQueue: make(chan *Item, 100_000),
goroutines: 0,
msgInFlight: utils.Int64(0),
msgInFlightLimit: utils.Int64(pref),
delayed: utils.Int64(0),
msgInFlight: toPtr(int64(0)),
msgInFlightLimit: toPtr(pref),
delayed: toPtr(int64(0)),
priority: pipeline.Priority(),
stopCh: make(chan struct{}),
}
Expand Down Expand Up @@ -396,3 +395,7 @@ func (c *Driver) consume() {
func ready(r uint32) bool {
return r > 0
}

func toPtr[T any](v T) *T {
return &v
}

0 comments on commit 004fb66

Please sign in to comment.