[WebConsole] Fix page sometimes goes blank on high-throughput change stream#4102
[WebConsole] Fix page sometimes goes blank on high-throughput change stream#4102Karakatiza666 wants to merge 1 commit into
Conversation
…stream Fix header disappearing at the top of a long change stream Signed-off-by: Karakatiza666 <bulakh.96@gmail.com>
I don't understand what this means In any case, this general code area has been a recurring problem zone riddled with bugs it would be good to find out if there are any standard/simple solutions we're missing for this |
|
{ "foo": "foo", "bar": "bar" } -> { "foobar": "bar" } |
|
I observe reduced perceived performance of change stream updates, I want to do another pass on this |
mythical-fred
left a comment
There was a problem hiding this comment.
Behavioral change — stream handling refactored from parseCancellable to BatchingWritableStream — with no tests added.
| batchTimeoutMs?: number | ||
| } | ||
|
|
||
| export class BatchingWritableStream<T> extends WritableStream<T> { |
There was a problem hiding this comment.
New BatchingWritableStream class introduces batching logic, back-pressure via setTimeout, and a batchTimeoutMs flush timer. This is non-trivial behavior that can fail in subtle ways (e.g., timer not cleared on abort, races between flush and close). Per Gerd's directive (2026-03-04): behavioral changes to the web-console require tests. Recommended stack: Vitest + @testing-library/svelte. Good starting target: unit tests for flushBatch logic and the abort path, without mounting any component.
|
Superceded by #6215 |
Fix header disappearing at the top of a long change stream
The cause of the issue going blank was due to the way backpressure relief when parsing high-throughput change stream JSON was implemented. Previously when backpressure occurred new cunks of data were simply discarded, but the parsing was re-attempted; usually skipping chunks of json string caused parsing to fail immediately, but sometimes dropping chunks results in a syntactically valid, but structurally invalid JSON, so the parsing succeeded, but the result values were unpredictable. These events caused UI to crash as malformed JSON objects propagated in the UI.
The fix is to re-start parsing when backpressure was relieved by dropping chunks of the stream