rat race
Closed this issue · 4 comments
wheresrhys commented
Any interest in adding this into your library. It's like race, but ignores errors unless all promises error
https://github.com/Financial-Times/promise-rat-race
hunterloftis commented
That's interesting, can you outline a use case for me?
wheresrhys commented
It's been useful when using microservices, in particular racing responses
from different nodes for reliability and performance. For one service we
have a cached response in the cdn, which has very flat response times, but
the median is far slower than hitting the origin directly, although the
origin sometimes experiences severe spikes in latency. Racing the two gives
far more reliable response times
…On Sun, 21 May 2017 at 7:03 pm, Hunter Loftis ***@***.***> wrote:
That's interesting, can you outline a use case for me?
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#13 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AAbUR01kBFUoGEpoiPwQj4HzVqZccinxks5r8HxYgaJpZM4NXRNE>
.
hunterloftis commented
Gotcha - in that case, you can use this already:
const winner = a.single([ rat0, rat1, rat2, rat3 ], Infinity)
The 2nd argument is the number of errors to ignore.
wheresrhys commented
I had a feeling something in the library would already cover it. thanks