B
B
blurx2020-08-11 15:29:41
Python
blurx, 2020-08-11 15:29:41

In response to an incoming webhook, the application must make several requests to the database, a couple of requests to a third-party API, how to decide?

In response to an incoming webhook, the application must make several requests to the database, a couple of requests to a third-party API, return 200 OK in response to the webhook, regardless of the results of the above requests. The service pulling the webhook requires the response to come within three seconds. What to do in this case?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
ThunderCat, 2020-08-11
@blurx

Give 200, then do what you need next, ideally just run a console command. If you don't want to mess around with console applications - here (actually not the first answer, but below - Complete version: ) it is described how to give content, close the connection and continue script execution. Briefly - we send the header of the end of the session and continue our dirty deeds without looking back at the client.
PS: I saw the python tag, but I think the meaning remains the same, in python under the web it’s not a big deal, but I think it will cope with the task of returning headers no worse than php.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question