Since I didn't want to bother with crontab,
I've been using the attached patch for a while.
If no property is given the backend update will run one time.
When -Donionoo.cron.runonce=false is given the updater will
run after waiting a minute and then every hour after a successful
update run. (Thus, it might also be a solution for #13003 (moved).)
Please review.
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information
Child items 0
Show closed items
No child items are currently assigned. Use child items to break down this issue into smaller parts.
Linked items 0
Link issues together to show that they're related.
Learn more.
That patch starts the first execution 1 minute after starting and then waits for 60 minutes between termination of one execution to start of the next.
Can we try to get closer to the current crontab behavior? That would be start at 15 minutes after the hour, unless an earlier execution is still running. I think scheduleAtFixedRate does that, right? And I think we don't need the lock file anymore if we go that route, correct?
Why should the crontab behavior be mimicked so closely?
Fixed rate scheduling would change the repeated update times also,
if a run takes longer than the set interval. Depending on the configuration
this might be another interval or an immediate restart.
The successive update-start depends only on the start time of the java process.
Started at 00:14 it would begin at 00:15. But I do not mind setting it to zero.
Especially, when there are several mirrors it might be advisable not to
do the downloads at the same time. The runtime of each run would spread the downloading over time.
Should the update interval be shorter, in order to have an update at about every hour?
The lock file will still be needed for the single run using crontab for scheduling
the executions. So, it should only show up there, I think.
The idea to run around :15 of the hour is that we can be quite confident that new data will be available at that time. The consensus gets published at :00, and CollecTor starts fetching the consensus and other descriptors at :05. That process usually takes a few minutes. If we have Onionoo download new data from CollecTor at :15 or :20, it's going to be new data, and the earlier we process new data the fresher Onionoo's data will be.
You have a point about not having all mirrors start at the exact same time. What we could do is start between :15 and :20, depending on when the program starts. For example, if the program starts at :01, we start the first run at :16 and the next run 60 minutes later.
Note that we also must avoid running more than once per hour. There's a bug where if we don't parse a fresh consensus, the exit/guard/middle probabilities cannot be calculated correctly. If we plan to run more often, we'll have to fix that bug first. I could imagine running every five minutes and stopping a run if we figure out that CollecTor has no new data for us.