mirror of
https://github.com/superseriousbusiness/gotosocial.git
synced 2025-11-27 21:03:33 -06: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))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue