Update share limits timer when share limits change #24670
Open
Kononkov1998 wants to merge 1 commit into
Open
Conversation
glassez
reviewed
Jul 12, 2026
Kononkov1998
force-pushed
the
fix-share-limits-timer
branch
from
July 15, 2026 09:27
b9e6ea1 to
6ffb961
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Ensures the share-limits enforcement timer (updateShareLimitsTimer()) is re-evaluated whenever global or category-based share limit settings change, preventing newly-enabled limits from remaining unenforced until a later unrelated event restarts the timer.
Changes:
- Recompute the share-limits timer state after updating a category’s options.
- Recompute the share-limits timer state after updating global share limits via
setShareLimits(). - Recompute the share-limits timer state when a torrent’s category changes.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Share limits are enforced by a periodic timer whose state is managed by
updateShareLimitsTimer(). Changes to category and global share limits do not always update the timer state. Consequently, enabling a limit while the timer is stopped may leave it unenforced until another event starts the timer, such as restarting qBittorrent or adding a torrent with active effective share limits.Category share limits: the timer state is not updated when categories are added, edited, or removed. Configured category limits are also only detected indirectly through the effective limits of existing torrents. Reproduction: with no global or per-torrent limits enabled, set a ratio limit on the category of a seeding torrent that has already exceeded it. The torrent continues seeding because the timer remains stopped.
Global share limits:
setShareLimits()changes the global limits without updating the timer state. Before Refactor torrent share limits #24029 each global share limit setter updated the timer; this was lost when they were merged intosetShareLimits(). Reproduction: with the timer stopped, enable a global ratio limit that a seeding torrent has already exceeded. The torrent continues seeding until another event starts the timer.This change updates the timer state after global share limits, category options, or a torrent's category change. The first issue also exists in released 5.2.x versions.