Skip to content

Commit b9f05c3

Browse files
chroschros
chros
authored and
chros
committed
Regularly send scrape request to trackers (See #2)
1 parent f254606 commit b9f05c3

File tree

1 file changed

+21
-0
lines changed

1 file changed

+21
-0
lines changed

src/pyrocore/data/config/rtorrent-0.8.6.rc

+21
Original file line numberDiff line numberDiff line change
@@ -110,3 +110,24 @@ branch=pyro.extended=,"schedule = bind_pyrotorque,0,0,\"ui.bind_key=download_lis
110110

111111
# TORQUE: Daemon watchdog
112112
system.method.insert = pyro.watchdog,simple|private,"execute_nothrow=bash,-c,\"$cat=\\\"test ! -f \\\",$argument.0=,\\\"/run/pyrotorque || \\\",$pyro.bin_dir=,\\\"pyrotorque --cron \\\",$argument.1=\""
113+
114+
# Regularly update scrape information for all torrents (even stopped ones), it won't affect the operation of rtorrent, but nice to have these values updated.
115+
# This info is only updated when rtorrent starts or a torrent is added by default.
116+
# Try to balance calls to not fire them up at the same time (since multiscraping isn't implemented in libtorrent). Check for update every 5 minutes and distinguish between 2 groups:
117+
# - transferring (uploading and/or downloading) torrents: update in every 10 minutes
118+
# - non-transferring torrents: update in every 12 hours
119+
# helper method: sets current time in a custom field (tm_last_scrape) and saves session
120+
method.insert = d.last_scrape.set, simple|private, "d.custom.set=tm_last_scrape,$cat=$system.time=; d.save_full_session="
121+
# helper method: sends the scrape request and sets the tm_last_scrape timestamp and saves session
122+
method.insert = d.last_scrape.send_set, simple, "d.tracker.send_scrape=0;d.last_scrape.set="
123+
# helper method: decides whether the required time interval (with the help of an argument) has passed and if so calls the above method
124+
method.insert = d.last_scrape.check_elapsed, simple|private, "branch={(elapsed.greater,$d.custom=tm_last_scrape,$argument.0=),d.last_scrape.send_set=}"
125+
# helper method: checks for non-existing/empty custom field to be able to test its validity later
126+
method.insert = d.last_scrape.check, simple|private, "branch={d.custom=tm_last_scrape,d.last_scrape.check_elapsed=$argument.0=,d.last_scrape.send_set=}"
127+
# helper method: decides whether a torrent transferring data or not
128+
method.insert = d.transferring.check, simple|private, "or={d.up.rate=,d.down.rate=}"
129+
# sets custom field (tm_last_scrape) to current time only for torrents just has been added (skips setting time on purpose when rtorrent started)
130+
method.set_key = event.download.inserted_new, last_scrape_i, "d.last_scrape.set="
131+
# check for update every 5 minutes (300 sec) and update scrape info for transferring torrents in every 10 minutes (600-20=580 sec) and for non-transferring ones in every 12 hours (43200-20=43180 sec)
132+
schedule2 = last_scrape_t, 300, 300, "d.multicall2=main,\"branch=$d.transferring.check=,d.last_scrape.check=580,d.last_scrape.check=43180\""
133+

0 commit comments

Comments
 (0)