M
M
max32772019-05-05 19:59:06
Django
max3277, 2019-05-05 19:59:06

How to execute a function after return in python?

Hello, I am writing a bot for VK in Python (Django)
The problem is that

In response to each event notification, your server should send an "ok" string.

The code can run for more than 1 minute (the report is generated from different sources).
VK throws new requests and duplicate messages come.
Is there any way to send "OK" to the server and continue generating the report. The user is then notified (wait 1 minute..)
return HttpResponse('ok')

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Sergey Gornostaev, 2019-05-05
@max3277

Use something like Celery .

A
Alexander, 2019-05-06
@NeiroNx

Nobody prevents you from running your processing in a separate thread.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question