Created
November 13, 2012 12:04
-
-
Save rarous/4065421 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| void RefreshProxyQueue() | |
| { | |
| var proxyQueue = queueFactory.Create(); | |
| var query = from provider in proxyProviders.ToObservable() | |
| from proxy in provider.GetActualProxyList() | |
| from isAvailable in IsAvailable(proxy) | |
| where isAvailable | |
| select proxy; | |
| query.Subscribe(proxyQueue.Enqueue); | |
| queue = proxyQueue; | |
| } | |
| IObservable<bool> IsAvailable(ProxyInfo proxy) | |
| { | |
| return Observable.Start(() => | |
| { | |
| bool result = proxy.IsAvailable(); | |
| //Log... | |
| return result; | |
| }); | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment