[Scheduler] "Ignore Scheduler" flag for torrents

dsouvik215

Member
May 25, 2018
896
0
16
I've previously been using uTorrent under Wine running in Virtualbox and sharing it via remote desktop with the household. Horribly inefficient but worked superbly! Now I've got around to setting up rTorrent/ruTorrent and wow - it's amazing! There is one annoying thing that will probably prevent me from using ruTorrent however...

I have a peak/off-peak quota so need the scheduler plugin. Occasionally though I will want to start a single torrent so I can have it immediately. In the old uTorrent setup that would simply mean choosing "Force Start" to make a single torrent start but the others still wait for the scheduler.

Now with ruTorrent, the scheduler overrides any setting I choose manually. That is, if I manually start a torrent, the scheduler will stop it again a short while later, or upon reload of the interface.

I've been looking at the code to think about how this could be implemented. Unfortunately I'm not good enough (or don't have the time to learn) to do it myself but this is how I think it could be done:

Firstly, in scheduler.php remove these lines from the apply() method:
Code:
self::setSpeed( 1, 1 );
...
self::setSpeed( SCH_DEF_UL, 1 );This will stop the scheduler from setting limits when stopped or seeding-only. As far as I can see they aren't needed anyway since everything is being stopped from downloading/uploading.

Add a "Ignore Scheduler" flag to the right click menu of each torrent. This would save the torrent hash into an array in the scheduler.dat file. Unselecting the "Ignore Scheduler" option (or on removal of the torrent) would remove the hash from the array.

In the scheduler.php getActiveTorrents() method, inside the for loop do a check against each torrent hash to see if it is in our "ignore" array, and if it is, don't put it into the seeds/leeches array that is returned from that method.

...and hopefully that's it. I could be completely misreading the code, but I think that should do what I want - allow the scheduler to control every torrent except those marked with the "Ignore Scheduler" flag, which we can then control ourselves manually.
One thing to note is the values in the scheduler's Limited1, Limited2, Limited3 would still be applied - but that could be a good thing.


Also, unrelated - I've noticed the times the scheduler kicks in and out at are 1/2 hour out. That is, if downloads are set to start at 2am, they actually start at 2:30am. Yes, I've checked the time on my server and it appears to be correct.
 

shwetha17

Member
May 24, 2018
785
0
16
the most SIMPLE solution to this problem is...use 2 users.

Create one user for your scheduled torrents, and one for your "add now"

you can EVEN create them with the same unix uid if you like, making them show up as the same user, and have the same download dir, though i'd probably use 2 users in the same group vs 2 users with the same uid, then set a umask of like 0002



as for the time thing, check your php timezone setting.
 

somus1735

Member
May 25, 2018
833
0
16
Command 'Ignore scheduler' was added to context menu in r1126. Available for rTorrent >= 0.8.5 only.

Quote
Also, unrelated - I've noticed the times the scheduler kicks in and out at are 1/2 hour out​


Something bad with timezone, i think. Also you can change $updateInterval variable in plugin's conf.php for more frequent checking.
 

dsouvik215

Member
May 25, 2018
896
0
16
O...M...F...G
It hasn't even been 24 hours! That is fantastic, thank you soooo much!

I will play with it and let you know how it performs, but initially it seems to work beautifully!

Except....
I still think the lines:
Code:
self::setSpeed( 1, 1 );
...
and
...
self::setSpeed( SCH_DEF_UL, 1 );should be removed from the apply() method. Perhaps there is a good reason why they are there, but it seems to me they are unneeded, and only throttle the "ingored" torrents when it shouldn't. That is, if torrents are being stopped, there should be no reason to throttle them as they shouldn't be using any bandwidth anyway. With these lines there, when the scheduler stops, it throttles *every* torrent to 1kb/s, including the "ignored" ones.

I have commented these lines out myself, and so far it seems to all work as I would expect. I will keep testing though in case there is something I haven't thought of...

Thankyou again sooooo much!
My torrent system is shared by "average joe" Windows users so needs to be kept as simple as possible. This method I think I'll be able to explain to them... wink.gif
 

somus1735

Member
May 25, 2018
833
0
16
Quote :
That is, if torrents are being stopped, there should be no reason to throttle them as they shouldn't be using any bandwidth anyway.

Except 'stop all' and 'seed only' we also have scheduler positions like 'restrict speed'. And 'ignored' torrents also must ignore these positions. Now I can't see a simple method for implement this. Will think.
 

dsouvik215

Member
May 25, 2018
896
0
16
Ah yes, you are correct. I haven't been using the "Limited" settings, just full on and off.

I guess the simplest answer for now would be setting the limits to maximum in both cases instead. That is:
Code:
self::setSpeed( SCH_DEF_UL, SCH_DEF_DL );and then just accepting that the "Limited1" "Limited2" "Limited3" setting in the scheduler will apply to *all* torrents including the ones with the "Ignore scheduler" flag set. That is a little bit confusing, but could be a good thing. It's certainly not as bad as the scheduler limiting everything to 1kb/s when turning off.

I will have a think too... smiley.gif
 

somus1735

Member
May 25, 2018
833
0
16
I found the solution.
1) Now all 'ignored' torrents also will ignore all throttle settings (include global and 'channel' settings from plugin 'throttle').
2) You must toggle 'ignored' torrents state (once) for changes in r1127 will has effect.
3) After changing of torrent state (ignored/not ignored) torrents will restarted (e.g. if its was active, then its will stopped and started - rtorrent require this).
Check.
 

dsouvik215

Member
May 25, 2018
896
0
16
So far it seems to work!

I will keep testing over the next few days and let you know how it goes.

Thanks again!