Skip to content

Conversation

@jnooree
Copy link
Contributor

@jnooree jnooree commented Apr 16, 2025

Summary

Prevent overcommit by using max 4 threads as intended.

Unintuitively, .max() returns the maximum value of self and the argument (not limiting to the argument). To limit the value to 4, one needs to use .min().

https://doc.rust-lang.org/std/cmp/trait.Ord.html#method.max

@jnooree jnooree changed the title fix: use max four threads, not at least four threads [red-knot] [ruff] use max four threads, not at least four threads Apr 16, 2025
Copy link
Member

@AlexWaygood AlexWaygood left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR!

@github-actions
Copy link
Contributor

mypy_primer results

No ecosystem changes detected ✅

@github-actions
Copy link
Contributor

ruff-ecosystem results

Linter (stable)

✅ ecosystem check detected no linter changes.

Linter (preview)

✅ ecosystem check detected no linter changes.

@jnooree
Copy link
Contributor Author

jnooree commented Apr 16, 2025

@AlexWaygood Could you merge this for me? I don't have write access to this repo.

@AlexWaygood
Copy link
Member

I don't have write access to this repo.

I know! I'm not the only maintainer here, though, and wanted to give other maintainers some time to chime in if they wanted to. Your reasoning seems correct to me, but I'm not familiar with this area of the codebase :-)

Copy link
Contributor

@carljm carljm left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks clearly correct to me (in that it makes the behavior match the comments describing the intended behavior.) If it were just the red-knot server, I'd just merge it, but since it also impacts the ruff LSP, I'd rather have @dhruvmanila confirm.

Copy link
Member

@dhruvmanila dhruvmanila left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice catch! I'm not sure how this slipped by but thank you for noticing and fixing it.

@dhruvmanila dhruvmanila added the server Related to the LSP server label Apr 17, 2025
@dhruvmanila dhruvmanila changed the title [red-knot] [ruff] use max four threads, not at least four threads Server: Use min instead of max to limit the number of threads Apr 17, 2025
@dhruvmanila dhruvmanila added the ty Multi-file analysis & type inference label Apr 17, 2025
@dhruvmanila dhruvmanila merged commit 58807b2 into astral-sh:main Apr 17, 2025
23 checks passed
@jnooree jnooree deleted the fix-nproc branch April 17, 2025 22:03
dcreager added a commit that referenced this pull request Apr 18, 2025
* main:
  [red-knot] class bases are not affected by __future__.annotations (#17456)
  [red-knot] Add support for overloaded functions (#17366)
  [`pyupgrade`] Add fix safety section to docs (`UP036`) (#17444)
  [red-knot] more type-narrowing in match statements (#17302)
  [red-knot] Add some narrowing for assignment expressions (#17448)
  [red-knot] Understand `typing.Protocol` and `typing_extensions.Protocol` as equivalent (#17446)
  Server: Use `min` instead of `max` to limit the number of threads (#17421)
dcreager added a commit that referenced this pull request Apr 18, 2025
* main: (123 commits)
  [red-knot] Handle explicit class specialization in type expressions (#17434)
  [red-knot] allow assignment expression in call compare narrowing (#17461)
  [red-knot] fix building unions with literals and AlwaysTruthy/AlwaysFalsy (#17451)
  [red-knot] Type narrowing for assertions (take 2) (#17345)
  [red-knot] class bases are not affected by __future__.annotations (#17456)
  [red-knot] Add support for overloaded functions (#17366)
  [`pyupgrade`] Add fix safety section to docs (`UP036`) (#17444)
  [red-knot] more type-narrowing in match statements (#17302)
  [red-knot] Add some narrowing for assignment expressions (#17448)
  [red-knot] Understand `typing.Protocol` and `typing_extensions.Protocol` as equivalent (#17446)
  Server: Use `min` instead of `max` to limit the number of threads (#17421)
  [red-knot] Detect version-related syntax errors (#16379)
  [`pyflakes`] Add fix safety section (`F841`) (#17410)
  [red-knot] Add `KnownFunction` variants for `is_protocol`, `get_protocol_members` and `runtime_checkable` (#17450)
  Bump 0.11.6 (#17449)
  Auto generate `visit_source_order` (#17180)
  [red-knot] Initial tests for protocols (#17436)
  [red-knot] Dataclasses: synthesize `__init__` with proper signature (#17428)
  [red-knot] Dataclasses: support `order=True` (#17406)
  [red-knot] Super-basic generic inference at call sites (#17301)
  ...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

server Related to the LSP server ty Multi-file analysis & type inference

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants