From 4831a44879822ebe643c9be1ada9447cd96c647a Mon Sep 17 00:00:00 2001 From: noctuum <25441068+noctuum@users.noreply.github.com> Date: Thu, 24 Sep 2026 18:02:56 +0500 Subject: [PATCH] Stop at max_active in scheduler.simple.removed The limit was checked once, then every download was resumed. --- src/command_scheduler.cc | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/command_scheduler.cc b/src/command_scheduler.cc index 4de7ae48..d2b11d3a 100644 --- a/src/command_scheduler.cc +++ b/src/command_scheduler.cc @@ -28,9 +28,10 @@ cmd_scheduler_simple_removed(core::Download* download) { control->core()->download_list()->pause(download); core::View* viewActive = *control->view_manager()->find("active"); + unsigned int numActive = viewActive->size_visible(); int64_t maxActive = rpc::call_command("scheduler.max_active", torrent::Object()).as_value(); - if ((int64_t)viewActive->size_visible() >= maxActive) + if ((int64_t)numActive >= maxActive) return torrent::Object(); // The 'started' view contains all the views we may choose amongst. @@ -41,6 +42,9 @@ cmd_scheduler_simple_removed(core::Download* download) { continue; control->core()->download_list()->resume(*itr); + + if ((int64_t)++numActive >= maxActive) + break; } return torrent::Object();