As far as I see it the answer is in the source code. ;-)
The file main.c
has a function run_scheduled_events
. The comment to this function says:
Perform regular maintenance tasks. This function gets run once per second by second_elapsed_callback()
.
Within the source code there is a list of things which this function does. As far as I see it item 2c deals with downloading the networkstatus:
2c. Every minute (or every second if TestingTorNetwork), check whether we want to download any networkstatus documents.
The code itself is:
#define networkstatus_dl_check_interval(o) ((o)->TestingTorNetwork ? 1 : 60)
if (!should_delay_dir_fetches(options, NULL) &&
time_to_download_networkstatus < now) {
time_to_download_networkstatus =
now + networkstatus_dl_check_interval(options);
update_networkstatus_downloads(now);
}
So it looks at should_delay_dir_fetches
in networkstatus.c
. If your network is enabled and you have running bridges/pluggable transports (in case you set it) all is fine. Furthermore it checks if a specific timer is less than the current time. If this is true, the timer is updated (current time plus 60 seconds) and update_networkstatus_downloads
is called which itself calls update_consensus_networkstatus_downloads
. This function takes care about the actual downloading.
The function is defined at line 733 in networkstatus.c
. It has a bit more logic inside. However as far as I see it, it waits until the current consensus is older than the current time. If this happens a new document is fetched.
You can also set logging at info level and will find lines like the following:
Jan 28 18:21:51.000 [info] update_consensus_networkstatus_downloads(): Launching microdesc networkstatus consensus download.
Jan 28 19:36:04.000 [info] update_consensus_networkstatus_downloads(): Launching microdesc networkstatus consensus download.
Summary: Every minute it is checked if the consensus document is too old. If it is older than the current time a new one will be fetched.