@@ -83,16 +83,28 @@ pub fn start(
8383
8484 info ! ( "Tracker statistics importer cronjob starting ..." ) ;
8585
86- // code-review: we set an execution interval to avoid intense polling to
87- // the database. If we remove the interval we would be constantly
88- // queering if there are torrent stats pending to update, unless there
89- // are torrents to update. Maybe we should only sleep for 100 milliseconds
90- // if we did not update any torrents in the latest execution.
91- // With this current limit we can only import 50 torrent stats every 100
92- // milliseconds which is 500 torrents per second (1800000 torrents per hour).
93- // If the tracker can handle a request in 100 milliseconds.
94-
95- let execution_interval_in_milliseconds = 100 ;
86+ // code-review:
87+ //
88+ // We set an execution interval to avoid intense polling to the
89+ // database. If we remove the interval we would be constantly queering
90+ // if there are torrent stats pending to update, unless there are
91+ // torrents to update. Maybe we should only sleep for 100 milliseconds
92+ // if we did not update any torrents in the latest execution. With this
93+ // current limit we can only import 50 torrent stats every 2000 seconds,
94+ // which is 500 torrents per second (1800000 torrents per hour).
95+ //
96+ // | Interval (secs) | Number of torrents imported per hour |
97+ // ------------------|--------------------------------------|
98+ // | 1 sec | 50 * (3600/1) = 180000 |
99+ // | 2 sec | 50 * (3600/2) = 90000 |
100+ // | 3 sec | 50 * (3600/3) = 60000 |
101+ // | 4 sec | 50 * (3600/4) = 45000 |
102+ // | 5 sec | 50 * (3600/5) = 36000 |
103+ //
104+ // The `execution_interval_in_milliseconds` could be a config option in
105+ // the future.
106+
107+ let execution_interval_in_milliseconds = 2000 ;
96108 let execution_interval_duration = std:: time:: Duration :: from_millis ( execution_interval_in_milliseconds) ;
97109 let mut execution_interval = tokio:: time:: interval ( execution_interval_duration) ;
98110
0 commit comments