Answer the question
In order to leave comments, you need to log in
C# webclient.DownloadStringTaskAsync request queue example?
Due to the limit of 3 requests per second, I constantly get a ban for 2.5 seconds. I have all calls to VK in the form of webclient.DownloadStringTaskAsync(...).
Help implement a queue to collect webclient.DownloadStringTaskAsync calls from many concurrent functions into a single queue.
Answer the question
In order to leave comments, you need to log in
По разному можно реализовать...
и ещё какие то конструкции, гуглите, а лучше посмотрите реализацию VK API на github, там называется vknet
Alternatively, you can make a class, say, QueuedWebClient
and implement the necessary methods for loading data in it, for example, the same DownloadString
. In the class, make a static instance Queue
and simply add links to the queue by which you need to download data or delegates, where some kind of loading logic is performed. Then, if you do not want to block the main thread, you can use some kind of timer and use it to pull the next element from the queue. You can add an event to the class itself QueuedWebClient
, which will be triggered when the downloaded data is ready.
But this is just one of the options.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question