Skip to content

style(types): fix return type annotation for get_all_requests#3919

Merged
lvhan028 merged 2 commits intoInternLM:mainfrom
xiaoajie738:main
Sep 3, 2025
Merged

style(types): fix return type annotation for get_all_requests#3919
lvhan028 merged 2 commits intoInternLM:mainfrom
xiaoajie738:main

Conversation

@xiaoajie738
Copy link
Copy Markdown
Contributor

@xiaoajie738 xiaoajie738 commented Sep 1, 2025

Thanks for your contribution and we appreciate it a lot. The following instructions would make your pull request more healthy and more easily receiving feedbacks. If you do not understand some items, don't worry, just make the pull request and seek help from maintainers.

Motivation

question1: The function actually returns a dictionary where each RequestType
maps to a list of Request objects. This change updates the type
hint to Dict[RequestType, List[Request]] for correctness and better
IDE/static type support.
question2: Previously, RequestManager.step accessed reqs_by_type[req_type] directly,
and the check if req_type not in reqs_by_type or len(reqs_by_type) == 0
was logically incorrect. This could cause the empty request queue to keep executing, wasting resources.

Modification

Please briefly describe what modification is made in this PR.

BC-breaking (Optional)

Does the modification introduce changes that break the backward-compatibility of the downstream repositories?
If so, please describe how it breaks the compatibility and how the downstream projects should modify their code to keep compatibility with this PR.

Use cases (Optional)

If this PR introduces a new feature, it is better to list some use cases here, and update the documentation.

Checklist

  1. Pre-commit or other linting tools are used to fix the potential lint issues.
  2. The modification is covered by complete unit tests. If not, please add more unit tests to ensure the correctness.
  3. If the modification has a dependency on downstream projects of a newer version, this PR should be tested with all supported versions of downstream projects.
  4. The documentation has been modified accordingly, like docstring or example tutorials.

@lvhan028 lvhan028 requested a review from grimoire September 1, 2025 11:13
Copy link
Copy Markdown
Collaborator

@grimoire grimoire left a comment

Choose a reason for hiding this comment

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

LGTM

@lvhan028 lvhan028 merged commit b7db520 into InternLM:main Sep 3, 2025
2 checks passed
littlegy pushed a commit to littlegy/lmdeploy that referenced this pull request Sep 11, 2025
…LM#3919)

* style(types): fix return type annotation for get_all_requests

* fix: safely handle empty request lists in RequestManager.step

---------

Co-authored-by: xiongjie <xiongjie@sensetime.com>
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.

3 participants