I'd take a look at why the error message says
`Future!(UserData)[]) to Future!(AnalyzeData)[]`
is AnalyzeData  the type returned by ProcessResponceData?

Alternatively you could use a singly linked list and splice out elements that pass the filter predicate. I think you'd have to roll your own though.

I am sorry Wilson I normally in my code UserData is AnalyzeData = UserData but I replace the name to make it more understandable.

For now I solved my problem like

vibe.core.concurrency.Future!(UserData)[] futurelist;
foreach( elem; elemList )
{
auto future = vibe.core.concurrency.async( &elem.makeWebRequest );
    futurelist ~= future;
}

int maximumSleepTime = 0;
while(futurelist.any!(a => !a.ready())) //--> Blocking until all of them ready
{
    maximumSleepTime++;
    sleep(10.msecs);
    if ( maximumSleepTime  > 2000 )
      return;
}

futurelist.each!(a=> Process(a.getResult()));

Unfortunately that is really bad when I make 250 web requests and only one of them is bad(I mean not ready). And 249 request have to wait for the bad one.

I will take a deeper look to data structure you suggested.

Thanks

Reply via email to