Skip to content

Guard against undetermined CPU count#245

Merged
adamchainz merged 1 commit intomasterfrom
fix_cpu_count
Aug 30, 2019
Merged

Guard against undetermined CPU count#245
adamchainz merged 1 commit intomasterfrom
fix_cpu_count

Conversation

@adamchainz
Copy link
Copy Markdown
Contributor

Spotted whilst adding test coverage in #242.

The psutil.cpu_count docs say it can return None in the case that the CPU count cannot be determined. This would lead to a TypeError in the multiplication, so fix that by assuming 'undetermined' means one CPU - incorrect statistics, but better than nothing.

Spotted whilst adding test coverage in #242.

The [`psutil.cpu_count` docs](https://psutil.readthedocs.io/en/latest/#psutil.cpu_count) say it can return `None` in the case that the CPU count cannot be determined. This would lead to a `TypeError` in the multiplication, so fix that by assuming 'undetermined' means one CPU - incorrect statistics, but better than nothing.
@adamchainz adamchainz merged commit c4f725d into master Aug 30, 2019
@adamchainz adamchainz deleted the fix_cpu_count branch August 30, 2019 08:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant