Commit 8a2428b
authored
fix(ttl_map): two minor fixes for ttl_map configuration parsing (#225)
This commit adds two small changes to improve how we parse TTLMapConfigs.
1. It strictly enforces that `tick` is an integer multiple of `ttl`. Previously,
we only recommened that in comments, with the consequence that:
```
true_ttl = desired_ttl - (desired_ttl % tick) <= desired_ttl
```
In the worst case, if `tick` is close to `ttl / 2` then the true `ttl` would
be equivalent to `tick`. For example, if the requested `ttl` was 60 seconds, and the tick
was 31 seconds, we would only allocate a single list of inputs to delete and free them every
tick.
2. There was a small bug in the validation logic that did not correctly validate that tick
was nonzero due to an incorrect application of DeMorgan's law. This commit fixes that to
correctly check that `tick` is nonzero.1 parent 731ad2a commit 8a2428b
1 file changed
+34
-6
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
133 | 133 | | |
134 | 134 | | |
135 | 135 | | |
136 | | - | |
137 | | - | |
| 136 | + | |
138 | 137 | | |
139 | | - | |
| 138 | + | |
140 | 139 | | |
141 | 140 | | |
142 | 141 | | |
| |||
150 | 149 | | |
151 | 150 | | |
152 | 151 | | |
153 | | - | |
154 | | - | |
| 152 | + | |
| 153 | + | |
155 | 154 | | |
156 | 155 | | |
157 | 156 | | |
158 | 157 | | |
| 158 | + | |
| 159 | + | |
| 160 | + | |
| 161 | + | |
| 162 | + | |
| 163 | + | |
159 | 164 | | |
160 | 165 | | |
161 | 166 | | |
| |||
167 | 172 | | |
168 | 173 | | |
169 | 174 | | |
170 | | - | |
| 175 | + | |
171 | 176 | | |
172 | 177 | | |
173 | 178 | | |
| |||
291 | 296 | | |
292 | 297 | | |
293 | 298 | | |
| 299 | + | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
294 | 322 | | |
295 | 323 | | |
296 | 324 | | |
| |||
0 commit comments