O
O
Oleg Gamega2016-10-26 19:00:21
JavaScript
Oleg Gamega, 2016-10-26 19:00:21

What is the best way to organize queues of asynchronous requests to VK?

Hello.
I am writing an application that works with VK api, since there are restrictions on the number of requests, I write delays between calls to calls to VK (which seems pretty crooked to me) There are a
lot of requests, I want to organize them somehow.
Thank you.

Answer the question

In order to leave comments, you need to log in

3 answer(s)
X
xozzslip, 2016-10-26
@xozzslip

There is no escape from delays. But, you can speed up.
First you need to switch to using execute , and if the speedup by 25 times is not enough, then you will have to somehow farm access tokens. You can register 4 apps per account in one sitting: then you can wait a few days and make 4 more. You can also buy accounts and connect to the created applications. In short, there are many options.
Then I personally did this: I created an asynchronous queue to which I added all access tokens. Then he created flows, inside which he captured these tokens from the queue. Thus, I had threads that captured the token and threads that did not have enough tokens. The thread that captured the token made calls synchronously, since in my case the next api call depended on the previous one. And at the end, the thread returned the token back to the queue, causing the next thread to wake up, grabbing this token.

K
Kirill Zhilyaev, 2016-10-26
@kirill_782

It is possible to throw off requests in a DB and to send through crowns. Or send some requests without a key, then there will be no restriction. Or use multiple keys

E
entermix, 2016-10-26
@entermix

You can break it into small subtasks and multithread using different appIds, use execute .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question