Repository navigation
Commit 50513bc
committed
fix: address review feedback on close, clamps, and polling test coverage
Complete the start() future when a data source is closed. No failure
permanently stops either data source now, so shutdown is the only remaining
exit for a caller that waits on that future without a timeout; previously such
a caller waited forever, since close() never completed it and the error-path
completion went away with the permanent-stop paths. Both processors now
complete it in close(), after the OFF status is published so a released thread
observes a consistent state. isInitialized() still reports false, so this
signals "done waiting" rather than "initialized", and it gives the constructor
a fast exit if another thread closes the client during startWaitTime.
StreamProcessor's future was a local in start() and unreachable from close(),
so it becomes a field as PollingProcessor already had; repeated start() calls
consequently share one future, which is how PollingProcessor has always
behaved and LDClient only calls start() once.
Replace the paired compareTo clamps in PollingStrategy.onFailure with a max()
helper. Assign-then-maybe-overwrite twice obscured that both bounds are simply
floored at the poll interval, and compareTo at the call site made the operand
order hard to read. Behavior is unchanged.
Add polling coverage that distinguishes the extended regime from the normal
cadence. testUnexpectedHttpErrorKeepsPolling used a 30ms extended initial delay
against a 20ms poll interval, so after the wait floor the extended wait landed
in 20-30ms and every assertion in it passed whether or not the extended regime
engaged -- its comment claimed the waits were observable but nothing observed
them. The gap that matters is broader: PollingStrategy is covered in isolation,
but the wiring from poll() through onFailure and nextWait into scheduleNext had
no coverage at all, which is where a mis-wired classifier call would hide.
unexpectedFailureUsesExtendedCadence and oneSuccessfulPollDoesNotLeaveExtended-
Cadence assert observed request spacing with a 500ms extended initial delay,
giving a 250-500ms wait against a 20ms normal cadence. Both use a lower bound
only, so CI slowness cannot fail them. Verified non-vacuous by swapping the
injected 401 for a 500: the observed gap drops to 33ms and the assertion fails,
which is what the previous test could not detect. Also adds the missing
"engaging extended backoff" log assertion, which the streaming counterpart
already had.1 parent a339e6b commit 50513bc
4 files changed
Lines changed: 67 additions & 14 deletions
File tree
- lib/sdk/server/src
- main/java/com/launchdarkly/sdk/server
- test/java/com/launchdarkly/sdk/server
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| 82 | + | |
82 | 83 | | |
83 | 84 | | |
84 | 85 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
77 | 77 | | |
78 | 78 | | |
79 | 79 | | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
86 | | - | |
87 | | - | |
| 80 | + | |
| 81 | + | |
88 | 82 | | |
89 | 83 | | |
90 | 84 | | |
| |||
138 | 132 | | |
139 | 133 | | |
140 | 134 | | |
| 135 | + | |
| 136 | + | |
| 137 | + | |
| 138 | + | |
141 | 139 | | |
142 | 140 | | |
143 | 141 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
114 | 114 | | |
115 | 115 | | |
116 | 116 | | |
| 117 | + | |
117 | 118 | | |
118 | 119 | | |
119 | 120 | | |
| |||
178 | 179 | | |
179 | 180 | | |
180 | 181 | | |
181 | | - | |
182 | | - | |
183 | 182 | | |
184 | 183 | | |
185 | 184 | | |
| |||
278 | 277 | | |
279 | 278 | | |
280 | 279 | | |
| 280 | + | |
281 | 281 | | |
282 | 282 | | |
283 | 283 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
49 | 49 | | |
50 | 50 | | |
51 | 51 | | |
| 52 | + | |
52 | 53 | | |
53 | 54 | | |
54 | 55 | | |
| |||
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
| 64 | + | |
| 65 | + | |
63 | 66 | | |
64 | 67 | | |
65 | 68 | | |
| |||
294 | 297 | | |
295 | 298 | | |
296 | 299 | | |
| 300 | + | |
| 301 | + | |
| 302 | + | |
| 303 | + | |
| 304 | + | |
| 305 | + | |
| 306 | + | |
| 307 | + | |
| 308 | + | |
| 309 | + | |
| 310 | + | |
| 311 | + | |
| 312 | + | |
| 313 | + | |
| 314 | + | |
| 315 | + | |
| 316 | + | |
| 317 | + | |
| 318 | + | |
| 319 | + | |
| 320 | + | |
| 321 | + | |
| 322 | + | |
| 323 | + | |
| 324 | + | |
| 325 | + | |
| 326 | + | |
| 327 | + | |
| 328 | + | |
| 329 | + | |
| 330 | + | |
| 331 | + | |
| 332 | + | |
| 333 | + | |
| 334 | + | |
| 335 | + | |
| 336 | + | |
| 337 | + | |
| 338 | + | |
| 339 | + | |
| 340 | + | |
| 341 | + | |
| 342 | + | |
| 343 | + | |
297 | 344 | | |
298 | | - | |
299 | | - | |
300 | | - | |
301 | | - | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
302 | 348 | | |
303 | 349 | | |
304 | 350 | | |
| |||
335 | 381 | | |
336 | 382 | | |
337 | 383 | | |
| 384 | + | |
| 385 | + | |
| 386 | + | |
| 387 | + | |
| 388 | + | |
| 389 | + | |
| 390 | + | |
| 391 | + | |
338 | 392 | | |
339 | 393 | | |
340 | 394 | | |
| |||
0 commit comments