mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-10-29 04:52:24 -05:00
[chore]: Bump go.uber.org/automaxprocs from 1.5.3 to 1.6.0 (#3376)
Bumps [go.uber.org/automaxprocs](https://github.com/uber-go/automaxprocs) from 1.5.3 to 1.6.0. - [Release notes](https://github.com/uber-go/automaxprocs/releases) - [Changelog](https://github.com/uber-go/automaxprocs/blob/master/CHANGELOG.md) - [Commits](https://github.com/uber-go/automaxprocs/compare/v1.5.3...v1.6.0) --- updated-dependencies: - dependency-name: go.uber.org/automaxprocs dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
This commit is contained in:
parent
188d28f054
commit
e3019eada4
8 changed files with 38 additions and 18 deletions
14
vendor/go.uber.org/automaxprocs/internal/runtime/cpu_quota_linux.go
generated
vendored
14
vendor/go.uber.org/automaxprocs/internal/runtime/cpu_quota_linux.go
generated
vendored
|
|
@ -25,15 +25,18 @@ package runtime
|
|||
|
||||
import (
|
||||
"errors"
|
||||
"math"
|
||||
|
||||
cg "go.uber.org/automaxprocs/internal/cgroups"
|
||||
)
|
||||
|
||||
// CPUQuotaToGOMAXPROCS converts the CPU quota applied to the calling process
|
||||
// to a valid GOMAXPROCS value.
|
||||
func CPUQuotaToGOMAXPROCS(minValue int) (int, CPUQuotaStatus, error) {
|
||||
cgroups, err := newQueryer()
|
||||
// to a valid GOMAXPROCS value. The quota is converted from float to int using round.
|
||||
// If round == nil, DefaultRoundFunc is used.
|
||||
func CPUQuotaToGOMAXPROCS(minValue int, round func(v float64) int) (int, CPUQuotaStatus, error) {
|
||||
if round == nil {
|
||||
round = DefaultRoundFunc
|
||||
}
|
||||
cgroups, err := _newQueryer()
|
||||
if err != nil {
|
||||
return -1, CPUQuotaUndefined, err
|
||||
}
|
||||
|
|
@ -43,7 +46,7 @@ func CPUQuotaToGOMAXPROCS(minValue int) (int, CPUQuotaStatus, error) {
|
|||
return -1, CPUQuotaUndefined, err
|
||||
}
|
||||
|
||||
maxProcs := int(math.Floor(quota))
|
||||
maxProcs := round(quota)
|
||||
if minValue > 0 && maxProcs < minValue {
|
||||
return minValue, CPUQuotaMinUsed, nil
|
||||
}
|
||||
|
|
@ -57,6 +60,7 @@ type queryer interface {
|
|||
var (
|
||||
_newCgroups2 = cg.NewCGroups2ForCurrentProcess
|
||||
_newCgroups = cg.NewCGroupsForCurrentProcess
|
||||
_newQueryer = newQueryer
|
||||
)
|
||||
|
||||
func newQueryer() (queryer, error) {
|
||||
|
|
|
|||
2
vendor/go.uber.org/automaxprocs/internal/runtime/cpu_quota_unsupported.go
generated
vendored
2
vendor/go.uber.org/automaxprocs/internal/runtime/cpu_quota_unsupported.go
generated
vendored
|
|
@ -26,6 +26,6 @@ package runtime
|
|||
// CPUQuotaToGOMAXPROCS converts the CPU quota applied to the calling process
|
||||
// to a valid GOMAXPROCS value. This is Linux-specific and not supported in the
|
||||
// current OS.
|
||||
func CPUQuotaToGOMAXPROCS(_ int) (int, CPUQuotaStatus, error) {
|
||||
func CPUQuotaToGOMAXPROCS(_ int, _ func(v float64) int) (int, CPUQuotaStatus, error) {
|
||||
return -1, CPUQuotaUndefined, nil
|
||||
}
|
||||
|
|
|
|||
7
vendor/go.uber.org/automaxprocs/internal/runtime/runtime.go
generated
vendored
7
vendor/go.uber.org/automaxprocs/internal/runtime/runtime.go
generated
vendored
|
|
@ -20,6 +20,8 @@
|
|||
|
||||
package runtime
|
||||
|
||||
import "math"
|
||||
|
||||
// CPUQuotaStatus presents the status of how CPU quota is used
|
||||
type CPUQuotaStatus int
|
||||
|
||||
|
|
@ -31,3 +33,8 @@ const (
|
|||
// CPUQuotaMinUsed is returned when CPU quota is smaller than the min value
|
||||
CPUQuotaMinUsed
|
||||
)
|
||||
|
||||
// DefaultRoundFunc is the default function to convert CPU quota from float to int. It rounds the value down (floor).
|
||||
func DefaultRoundFunc(v float64) int {
|
||||
return int(math.Floor(v))
|
||||
}
|
||||
|
|
|
|||
21
vendor/go.uber.org/automaxprocs/maxprocs/maxprocs.go
generated
vendored
21
vendor/go.uber.org/automaxprocs/maxprocs/maxprocs.go
generated
vendored
|
|
@ -37,9 +37,10 @@ func currentMaxProcs() int {
|
|||
}
|
||||
|
||||
type config struct {
|
||||
printf func(string, ...interface{})
|
||||
procs func(int) (int, iruntime.CPUQuotaStatus, error)
|
||||
minGOMAXPROCS int
|
||||
printf func(string, ...interface{})
|
||||
procs func(int, func(v float64) int) (int, iruntime.CPUQuotaStatus, error)
|
||||
minGOMAXPROCS int
|
||||
roundQuotaFunc func(v float64) int
|
||||
}
|
||||
|
||||
func (c *config) log(fmt string, args ...interface{}) {
|
||||
|
|
@ -71,6 +72,13 @@ func Min(n int) Option {
|
|||
})
|
||||
}
|
||||
|
||||
// RoundQuotaFunc sets the function that will be used to covert the CPU quota from float to int.
|
||||
func RoundQuotaFunc(rf func(v float64) int) Option {
|
||||
return optionFunc(func(cfg *config) {
|
||||
cfg.roundQuotaFunc = rf
|
||||
})
|
||||
}
|
||||
|
||||
type optionFunc func(*config)
|
||||
|
||||
func (of optionFunc) apply(cfg *config) { of(cfg) }
|
||||
|
|
@ -82,8 +90,9 @@ func (of optionFunc) apply(cfg *config) { of(cfg) }
|
|||
// configured CPU quota.
|
||||
func Set(opts ...Option) (func(), error) {
|
||||
cfg := &config{
|
||||
procs: iruntime.CPUQuotaToGOMAXPROCS,
|
||||
minGOMAXPROCS: 1,
|
||||
procs: iruntime.CPUQuotaToGOMAXPROCS,
|
||||
roundQuotaFunc: iruntime.DefaultRoundFunc,
|
||||
minGOMAXPROCS: 1,
|
||||
}
|
||||
for _, o := range opts {
|
||||
o.apply(cfg)
|
||||
|
|
@ -102,7 +111,7 @@ func Set(opts ...Option) (func(), error) {
|
|||
return undoNoop, nil
|
||||
}
|
||||
|
||||
maxProcs, status, err := cfg.procs(cfg.minGOMAXPROCS)
|
||||
maxProcs, status, err := cfg.procs(cfg.minGOMAXPROCS, cfg.roundQuotaFunc)
|
||||
if err != nil {
|
||||
return undoNoop, err
|
||||
}
|
||||
|
|
|
|||
2
vendor/go.uber.org/automaxprocs/maxprocs/version.go
generated
vendored
2
vendor/go.uber.org/automaxprocs/maxprocs/version.go
generated
vendored
|
|
@ -21,4 +21,4 @@
|
|||
package maxprocs
|
||||
|
||||
// Version is the current package version.
|
||||
const Version = "1.5.2"
|
||||
const Version = "1.6.0"
|
||||
|
|
|
|||
4
vendor/modules.txt
vendored
4
vendor/modules.txt
vendored
|
|
@ -1046,8 +1046,8 @@ go.opentelemetry.io/proto/otlp/collector/trace/v1
|
|||
go.opentelemetry.io/proto/otlp/common/v1
|
||||
go.opentelemetry.io/proto/otlp/resource/v1
|
||||
go.opentelemetry.io/proto/otlp/trace/v1
|
||||
# go.uber.org/automaxprocs v1.5.3
|
||||
## explicit; go 1.18
|
||||
# go.uber.org/automaxprocs v1.6.0
|
||||
## explicit; go 1.20
|
||||
go.uber.org/automaxprocs/internal/cgroups
|
||||
go.uber.org/automaxprocs/internal/runtime
|
||||
go.uber.org/automaxprocs/maxprocs
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue