Anurag-Sharma
Anurag-Sharma

Reputation: 4418

Django request/response multithreading

The workflow of my app is -

User submits a file
On receiving -> process_file()
return response

This could result in timeouts if the process_file() takes much time, so how could I send back the response before and then process the file and send the desired output to user later.
I have checked out django-celery but I think it's quite heavy for a small app which I am trying to build.

Update: I searched a bit around on the internet, and if anyone would like to use celery, here is a nice blog post, that could help you solve this situation - [Link]

Upvotes: 1

Views: 803

Answers (1)

Wtower
Wtower

Reputation: 19922

You can use Celery for that matter:

Celery is an asynchronous task queue/job queue based on distributed message passing. It is focused on real-time operation, but supports scheduling as well.

The execution units, called tasks, are executed concurrently on a single or more worker servers using multiprocessing, Eventlet, or gevent. Tasks can execute asynchronously (in the background) or synchronously (wait until ready).

Upvotes: 1

Related Questions