Down-weight current runs too when computing wfu/tk

Closed Roger Dingledine requested to merge arma/tor:bug40395 into maint-0.4.5

Otherwise the earlier runs decay to small numbers, while the current run becomes a huge number, and then relays with high uptime dominate all the wfu and tk stats.

For now I'm leaving the mtbf tracking alone -- that is, mtbf is still dominated by the uptime of the current run -- because otherwise many relays lose their Stable flag and thus their Guard flag. It's not at all clear that we're assigning the Stable flag in a smart way, but also it's not clear that changing it to downweight the current run is what we want (if we downweight the total_run_weights variable, it decays more than it should, or if we don't, it decays less than it should).

The long term answer is that we need to use past data to assess how various approaches predict future behavior. But I'm doing this minimal change now since this bugfix paves the way for the HSDir assignment changes in #19162.

Resolves #40395.

Merge request reports