Эта страница ещё не переведена, поэтому показана на английском. Помогите с переводом

Retry the flaky fetch

Toss-up async

Requirement

The manifest endpoint resets the connection exactly twice before serving its payload. Retry until it succeeds, with a budget of three attempts in total, then print the payload and how many attempts it took. The failure injection is deterministic and in the code; both versions must print the lines shown under Expected output.

Expected output
manifest 2026-08 (12 entries)
attempts: 3

Side by side

RxDart

FxDart

Why they differ

Scarcely at all — this is one call on each side, and that is the point of the pair. The difference is what "try again" means in each model. In RxDart a stream that has errored is dead, so Rx.retry takes a factory and re-subscribes it: retrying is re-listening, and the count argument is the number of retries after the first attempt (here 2, for three attempts). In FxDart the flaky thing is a Future-returning function, so retry just calls it again — attempts is the total budget (3), and the last error rethrows with its original stack trace when the budget is spent.

A genuine tie. The shapes only diverge when the retried thing grows: if it becomes a multi-value pipeline, RxDart keeps the same factory idiom, while FxDart wraps the terminal (retry(3, () => fxAsync(…).toList())) or moves to per-element retries — a pair of its own, two examples ahead.

Benchmark

Apple M1 Max, 32 GB RAM · Dart 3.12.2 (AOT-compiled) · 2026-08-18

Async case: the headline scale is N = 10,000, not 1,000,000. Every element costs an event-loop turn on both sides, so a million real awaits would measure Dart's event loop for minutes — not the pipeline. Delays are zero-length and the example's concurrency limit is kept; what the bars compare is the pipeline machinery.

N = 100

Time Tie

RxDart 586 µs
FxDart 504 µs

Peak memory Tie

RxDart 16.5 MB
FxDart 16.3 MB

N = 10,000

Time FxDart wins

RxDart 49.8 ms
FxDart 43.0 ms

Peak memory Tie

RxDart 24.0 MB
FxDart 24.0 MB

Bars are medians of repeated timed iterations in fresh processes per side (small N is batched for timer resolution). Sides within 5% of each other — or within 0.6 ms, a difference no person can perceive — count as a tie; close relative races are re-measured up to 5 runs. In an app, anything under a few milliseconds is invisible to the user regardless of which bar is shorter. Memory is peak process RSS. The Dart VM and the dataset are identical on both sides, so the difference between the two bars is what the pipeline itself holds onto.