You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
So the jobs are completed correctly in no specific order and in around the same time, which is exactly what I want.
Now if I introduce the CloudflareSolver inside those tasks, I will write something like this
Stopwatchsw=newStopwatch();varjobs=5;vartarget=newUri("http://example.com");vartasks=Enumerable.Range(1,jobs).Select(async n =>{using(varhandler=newHttpClientHandler()){using(varclient=newHttpClient(handler)){varcf=newCloudflareSolver(){MaxTries=3,ClearanceDelay=3000};varresult=awaitcf.Solve(client,handler,target);Console.WriteLine($"[{sw.Elapsed.TotalSeconds} s] [Job {n}] Completed");}}});sw.Start();Console.WriteLine($"Started {jobs} jobs");Task.WhenAll(tasks).Wait();sw.Stop();
which for any website (both protected by cloudflare and not) gives this result (in the cloudflare case since it takes more time the timestamps are like 3s, 6s, 9s etc)
This is clearly a synchronous execution where only one solver is able to run at the same time even if I have multiple separate instances of the solvers.
Why do you think this happens?
Thank you for your help,
Ruri
P.S. the same happens even if I give it the ClearanceHandler directly.
The text was updated successfully, but these errors were encountered:
In case you are wondering why I need to do this, instead of just solving the challenge once and then using the cookies for my multiple requests, it's because I want to use a different proxy for each of the 5 http clients, so I need to solve 5 different challenges since one challenge is valid only for a certain IP, as I'm sure you're already aware.
Hi, I fixed this issue by removing the SemaphoreLocker in CloudflareDetector.cs and removing the static keyword from the one in CloudflareSolver.cs
Do you want me to make a pull request or would you prefer to keep the lock? It does break multithread use so it's up to you.
Hello,
first of all I'd like to thank you for your amazing library!
I want to solve multiple challenges at the same time in a multithreaded way.
In this snippet I will execute a get request in parallel for the same website 5 times, using the standard HttpClient without the solver:
The output will look like this:
So the jobs are completed correctly in no specific order and in around the same time, which is exactly what I want.
Now if I introduce the CloudflareSolver inside those tasks, I will write something like this
which for any website (both protected by cloudflare and not) gives this result (in the cloudflare case since it takes more time the timestamps are like 3s, 6s, 9s etc)
This is clearly a synchronous execution where only one solver is able to run at the same time even if I have multiple separate instances of the solvers.
Why do you think this happens?
Thank you for your help,
Ruri
P.S. the same happens even if I give it the ClearanceHandler directly.
The text was updated successfully, but these errors were encountered: