Skip to content

Commit

Permalink
Fixes #370
Browse files Browse the repository at this point in the history
Bug causing min_num_seeds not being respected when cleanup set to false
  • Loading branch information
bobokun committed Aug 9, 2023
1 parent 47d68ee commit 99efdbf
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 11 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
4.0.3-develop4
4.0.3-develop5
22 changes: 12 additions & 10 deletions modules/core/share_limits.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ def update_share_limits(self):
"torrent_max_ratio": group_config["max_ratio"],
"torrent_max_seeding_time": group_config["max_seeding_time"],
"torrent_min_seeding_time": group_config["min_seeding_time"],
"torrent_min_num_seeds": group_config["min_num_seeds"],
"torrent_limit_upload_speed": group_config["limit_upload_speed"],
}
if len(self.torrents_updated) > 0:
Expand Down Expand Up @@ -196,6 +197,7 @@ def update_share_limits_for_group(self, group_name, group_config, torrents):
"Config Max Seeding Time vs Torrent Max Seeding Time: "
f"{group_config['max_seeding_time']} vs {torrent.max_seeding_time}"
)
logger.trace(f"Config Min Num Seeds vs Torrent Num Seeds: {group_config['min_num_seeds']} vs {torrent.num_complete}")
logger.trace(f"check_max_seeding_time: {check_max_seeding_time}")
logger.trace(
"Config Limit Upload Speed vs Torrent Limit Upload Speed: "
Expand All @@ -218,17 +220,17 @@ def update_share_limits_for_group(self, group_name, group_config, torrents):
self.stats_tagged += 1
self.torrents_updated.append(t_name)

tor_reached_seed_limit = self.has_reached_seed_limit(
torrent=torrent,
max_ratio=group_config["max_ratio"],
max_seeding_time=group_config["max_seeding_time"],
min_seeding_time=group_config["min_seeding_time"],
min_num_seeds=group_config["min_num_seeds"],
resume_torrent=group_config["resume_torrent_after_change"],
tracker=tracker["url"],
)
# Cleanup torrents if the torrent meets the criteria for deletion and cleanup is enabled
if group_config["cleanup"]:
tor_reached_seed_limit = self.has_reached_seed_limit(
torrent=torrent,
max_ratio=group_config["max_ratio"],
max_seeding_time=group_config["max_seeding_time"],
min_seeding_time=group_config["min_seeding_time"],
min_num_seeds=group_config["min_num_seeds"],
resume_torrent=group_config["resume_torrent_after_change"],
tracker=tracker["url"],
)
if tor_reached_seed_limit:
if t_hash not in self.tdel_dict:
self.tdel_dict[t_hash] = {}
Expand Down Expand Up @@ -421,7 +423,7 @@ def _is_less_than_min_num_seeds():
print_log += logger.print_line(logger.insert_space(f"Tracker: {tracker}", 8), self.config.loglevel)
print_log += logger.print_line(
logger.insert_space(
f"Min number of seeds not met: Total Seeds ({torrent.num_complete}) <"
f"Min number of seeds not met: Total Seeds ({torrent.num_complete}) < "
f"min_num_seeds({min_num_seeds}). Removing Share Limits so qBittorrent can continue"
" seeding.",
8,
Expand Down

0 comments on commit 99efdbf

Please sign in to comment.