8000 [27.x backport] pkg/sysinfo: Deprecate NumCPU by thaJeztah · Pull Request #49247 · moby/moby · GitHub
[go: up one dir, main page]

Skip to content

Conversation

thaJeztah
Copy link
Member

backport:

Deprecate in favor of runtime.NumCPU as the behavior is the same now.

- Description for the changelog

Go SDK: pkg/sysinfo: deprecate NumCPU. This utility has the same behavior as runtime.NumCPU.

- A picture of a cute animal (not mandatory but encouraged)

- Description for the changelog

- A picture of a cute animal (not mandatory but encouraged)

thaJeztah and others added 2 commits January 9, 2025 18:19
sysinfo.NumCPU returns the number of CPUs which are currently online,
which involves some syscalls and parsing on Windows.

Change the code to only retrieve this information when needed, and
memoize the result to prevent calling this function multiple times.

Ideally, we'd obtain this information from daemon.RawSysInfo(), but
that uses a sync.Once, which could return outdated information.

Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
(cherry picked from commit ddd885a)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
Deprecate in favor of `runtime.NumCPU` as the behavior is the same now.

Signed-off-by: Paweł Gronowski <pawel.gronowski@docker.com>
(cherry picked from commit 3db72b2)
Signed-off-by: Sebastiaan van Stijn <github@gone.nl>
@thaJeztah thaJeztah added status/2-code-review impact/changelog impact/deprecation kind/refactor PR's that refactor, or clean-up code area/go-sdk impact/go-sdk Noteworthy (compatibility changes) in the Go SDK labels Jan 9, 2025
@thaJeztah thaJeztah added this to the 27.5.0 milestone Jan 9, 2025
@thaJeztah thaJeztah self-assigned this Jan 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/go-sdk impact/changelog impact/deprecation impact/go-sdk Noteworthy (compatibility changes) in the Go SDK kind/refactor PR's that refactor, or clean-up code status/2-code-review
Projects
Development

Successfully merging this pull request may close these issues.

3 participants
0