H
H
hesy2019-02-27 20:53:09
PHP
hesy, 2019-02-27 20:53:09

VK API Timeout was reached or how to quickly send a response?

There is a bot that processes the photo uploaded by the user.
The processing time takes ~5-10+ seconds on average (depending on the size of the photo), so because of this, the bot starts to go crazy and sends several responses at some intervals.
Regular messages are processed instantly, there are no problems here.
Therefore, the question is: how to quickly send an ok answer, and calmly process the photo and then send it?
I am using Callback API.
Examples of failed requests:

Error: Timeout was reached. Attempt 1/5

HTTP/1.1 200 OK
Date: Wed, 27 Feb 2019 17:39:38 GMT
Content-Type: text/html; charset=UTF-8
Transfer-Encoding: chunked
Connection: keep-alive
Server: awex
X-Xss-Protection: 1; mode=block
X-Content-Type-Options: nosniff
X-Request-ID: 9bded4270881f9745c89adf78561f5ad

ok

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
Dmitry, 2019-02-27
@hesy

You get a photo, write it to the database as a new task for processing, give the answer ok. The crontab script spins, takes all the tasks from the database, does the processing, sends a response to the desired chat. Or explore queues like rabbitmq

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question