For each node in the consensus, we call node_set_hsdir_index() which gets the time period and srv start time to learn if we are in between TP and SRV or not.
These calls ultimately call get_voting_schedule() which allocates memory and prints a debug log everytime.
All of this is actually pretty heavy and they are values we can cache because they are all based on the timings of a new consensus (valid_after, valid_until, fresh_until).
It is also called every second by a tor with a hidden service.
Caching those and updating when we get a new consensus seems a light refactoring for a good performance improvement.
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.
It was actually more straight forward than I thought.
Instead of keeping a star time of current round and time period and what not, we actually don't need to do such a thing but rather use the voting schedule static object instead. It is updated everytime we get a new consensus so using it is as close as we get to the latest.
Thus, now the SR subsystem only uses that object to compute it stuff.
Unit test is broken because we have an issue of timestamp being off because one function used to take a timestamp "now" but now it only uses the voting schedule timings so it needs to be fixed. However, I want to know if the approach seems sensible before going further.
See branch: ticket23623_032_01
Trac: Status: accepted to needs_review Reviewer: N/Ato asn
Why is the test_get_next_valid_after_time test removed? It's a little worrisome to remove unit tests. Do the same tests now get performed in some other way?
Before that patch, the function get_next_valid_after_time(time_t now), which was renamed in this patch to dirvote_get_next_valid_after_time(void), was allocating a voting schedule using now and returning the voting_schedule.interval_starts of that newly created schedule.
We now use a static voting schedule and update it with dirvote_recalculate_timing(), the test became pointless because that function now only returns interval_starts which is from the static voting schedule. Thus it is not needed as the test have been modified to use a static object and update it as it goes.