Closed alonsohki closed 5 years ago
Not exactly. Race() is the first of All(), while First() is the first of Sequence().
This is how I am using it, which is a good use case:
ResolveDNS(server)
.Then(entry =>
{
var requests = from address in entry.AddressList
select new Func<IPromise<double>>(() => GetNTPTime(address));
return Promise<double>.First(requests);
})
It takes a list of addresses that a host resolves to, and returns the first one that works (in case one of them doesn't work, times out, or raises any other issue).
Is there any reason why this isn't being approved?
@Borningstar or @kalvinpearce can you take a look at this?
Looks cool but isn't this the same functionality as
Promise.Race
?