Created
November 12, 2012 14:30
-
-
Save rarous/4059724 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
| query.Subscribe(x => | |
| { | |
| Task.Factory.StartNew(() => | |
| { | |
| if (IsAvailable(x)) | |
| proxyQueue.Enqueue(x); | |
| }, TaskCreationOptions.LongRunning); | |
| }); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Snad jsme tě pochopil, ten kód by šel samozřejmě vylepšit přes RXX
using System;
using System.Collections.Concurrent;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Reactive;
using System.Text;
using System.Reactive.Linq;
namespace AlesRX
{
class Program
{
static void Main(string[] args)
{
var currentRequestResults = from uri in query
let request = WebRequest.Create(uri)
from result in Observable.FromAsyncPattern(request.BeginGetResponse, ar =>
{
request.EndGetResponse(ar);
return true;
})()
.Catch<bool, WebException>(_ => Observable.Return(false))
select new
{
Uri = uri,
Result = result
};
}
}