8000 Don't unpack if `UnpackLimit` is set to `0` by Cucumberrbob · Pull Request #817 · rogerfar/rdt-client · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

Don't unpack if UnpackLimit is set to 0 #817

8000
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
May 18, 2025

Conversation

Cucumberrbob
Copy link
Collaborator
@Cucumberrbob Cucumberrbob commented May 17, 2025

User description

Fixes #218


PR Type

enhancement, documentation


Description

  • Added ability to disable auto unpacking by setting UnpackLimit to 0.

  • Updated setting description to clarify disabling behavior.

  • Modified unpacking logic to skip when UnpackLimit is 0.


Changes walkthrough 📝

Relevant files
Documentation
DbSettings.cs
Clarify UnpackLimit setting disables unpacking at 0           

server/RdtClient.Data/Models/Internal/DbSettings.cs

  • Updated the description for UnpackLimit to clarify that setting it to
    0 disables unpacking.
  • +1/-1     
    Enhancement
    TorrentRunner.cs
    Support disabling unpacking when UnpackLimit is 0               

    server/RdtClient.Service/Services/TorrentRunner.cs

  • Removed forced minimum of 1 for UnpackLimit.
  • Updated unpacking logic to skip unpacking if UnpackLimit is 0.
  • +2/-5     

    Need help?
  • Type /help how to ... in the comments thread for any questions about Qodo Merge usage.
  • Check out the documentation for more information.
  • Copy link
    Contributor

    PR Reviewer Guide 🔍

    Here are some key observations to aid the review process:

    🎫 Ticket compliance analysis ✅

    218 - Fully compliant

    Compliant requirements:

    • Add ability to disable auto unpacking for files
    • Setting 'Maximum unpack processes' to 0 should disable unpacking

    ⏱️ Estimated effort to review: 1 🔵⚪⚪⚪⚪
    🧪 No relevant tests
    🔒 No security concerns identified
    ⚡ No major issues detected

    Copy link
    Contributor
    qodo-merge-pro bot commented May 17, 2025

    PR Code Suggestions ✨

    Explore these optional code suggestions:

    CategorySuggestion                                                                                                                                    Impact
    General
    Validate against negative values
    Suggestion Impact:The suggestion was directly implemented in the commit. The exact code changes suggested (adding an if statement to check if settingUnpackLimit is negative and set it to 0 if so) were added to the code.

    code diff:

    +        if (settingUnpackLimit < 0)
    +        {
    +            settingUnpackLimit = 0;
    +        }

    Consider validating that UnpackLimit is not negative. While 0 is now a valid
    value to disable unpacking, negative values could cause unexpected behavior. Add
    a check to ensure the value is at least 0.

    server/RdtClient.Service/Services/TorrentRunner.cs [83]

     var settingUnpackLimit = Settings.Get.General.UnpackLimit;
    +if (settingUnpackLimit < 0)
    +{
    +    settingUnpackLimit = 0;
    +}

    [Suggestion processed]

    Suggestion importance[1-10]: 7

    __

    Why: Adding a check to prevent negative values for UnpackLimit is a sensible safeguard that improves robustness, as negative limits could lead to undefined or erroneous behavior. This is a minor but meaningful improvement to input validation.

    Medium
    General
    Add clarifying comment
    Suggestion Impact:The suggestion was about explaining the difference in validation between downloadLimit and unpackLimit. The commit implemented validation for unpackLimit that allows 0 as a minimum value, which aligns with the suggestion's intent to clarify this behavior difference, though it used code rather than a comment.

    code diff:

    +        if (settingUnpackLimit < 0)
    +        {
    +            settingUnpackLimit = 0;
    +        }

    The code enforces a minimum value of 1 for settingDownloadLimit but doesn't
    apply similar validation for settingUnpackLimit. Since the PR now supports 0 as
    a valid value to disable unpacking, consider adding a comment to explain this
    difference in validation approach.

    server/RdtClient.Service/Services/TorrentRunner.cs [77-83]

     var settingDownloadLimit = Settings.Get.General.DownloadLimit;
     if (settingDownloadLimit < 1)
     {
         settingDownloadLimit = 1;
     }
     
     var settingUnpackLimit = Settings.Get.General.UnpackLimit;
    +// UnpackLimit can be 0 to disable unpacking completely

    [Suggestion processed]

    Suggestion importance[1-10]: 5

    __

    Why: Adding a clarifying comment helps future maintainers understand why settingUnpackLimit is not validated like settingDownloadLimit, which improves code readability and maintainability, but it does not affect functionality or correctness.

    Low
    • Update

    Co-authored-by: qodo-merge-pro[bot] <151058649+qodo-merge-pro[bot]@users.noreply.github.com>
    @rogerfar rogerfar merged commit 2a38d43 into rogerfar:main May 18, 2025
    1 check passed
    @Cucumberrbob Cucumberrbob deleted the feat/turn-off-auto-unpack branch May 18, 2025 17:26
    Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
    Projects
    None yet
    Development

    Successfully merging this pull request may close these issues.

    Disable auto Unpack?
    2 participants
    0