Examples

Page 8 of 50

Browse code examples

javascriptSnippet

Hedged Requests Race Replicas

Start a backup replica after a short tail delay and race it against the primary, keeping the first answer so slow replicas stop dominating latency.

javascriptSnippet

Lazy Async Init Single Promise

The first call starts one init promise that every caller shares, and a rejection clears it so the next call retries instead of failing forever.

javascriptSnippet

concat Merges Without Flattening

concat returns a fresh array merging arguments and spreads values shallowly: nested arrays stay nested and objects are shared by reference with the source.