Commit 632634d
knkhmelevsky
feat userver-recentperiod: lower contention effects on buckets
Under high contention, `RecentPeriod` tended to increment the current index twice, which led to "zeroed" buckets that stopped the cycle in `GetStatsForPeriod`. In cases of a stable signal, this caused drops in the returned value down to 0, with restoration to the actual value only after `MaxDuration`—when all buckets had been revisited.
This fix does not aim to provide an algorithmically safe solution, but it does practically reduce the frequency of such drops.
commit_hash:ec2be57aec578dcce323ac1a17468c3e1779a0911 parent 64e1219 commit 632634d
1 file changed
+8
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
109 | 109 | | |
110 | 110 | | |
111 | 111 | | |
112 | | - | |
| 112 | + | |
113 | 113 | | |
114 | 114 | | |
115 | 115 | | |
| |||
121 | 121 | | |
122 | 122 | | |
123 | 123 | | |
124 | | - | |
| 124 | + | |
| 125 | + | |
| 126 | + | |
125 | 127 | | |
126 | 128 | | |
127 | 129 | | |
128 | 130 | | |
129 | | - | |
| 131 | + | |
130 | 132 | | |
131 | 133 | | |
132 | 134 | | |
| |||
159 | 161 | | |
160 | 162 | | |
161 | 163 | | |
162 | | - | |
| 164 | + | |
163 | 165 | | |
164 | | - | |
165 | | - | |
| 166 | + | |
| 167 | + | |
166 | 168 | | |
167 | 169 | | |
168 | 170 | | |
| |||
0 commit comments