Send process to server and release user

Asked

Viewed 110 times

1

I’m having a problem in an application that uses 3G and is very slow to keep the user waiting.

Does anyone know any library that I can send the information to the server and release the user?

The information is a batch of 100 sets of numbers that will be added in the bank one by one.

This is not an asynchronous code because I don’t need to inform the user that it was a mistake or a hit. I’ll just send the information to the server and that’s it.

  • 1

    Take a look at the Celery, because your problem in my understanding is getting Django to start a time-consuming processing outside the request-response cycle. That’s right?

2 answers

2

Opa!

Depending on what you need, Celery can be a bit much. When I have something simple that I need to do this queuing scheme, and asynchronous processing, I use the Rq.

It is very simple to use and even has a app to Django that facilitates implementation.

Hug!

  • I would like to know why someone has denied that answer...

0


You can use the Celery to do this.

It is an asynchronous job queue library based on distributed message passing. It is focused on real-time operations, but supports scheduling as well.

Celery is very suitable to do what you need: run something after the web request is finished. Also is trusted and used by apps like Instagram.

Basically you write a task in Python and configure a "worker" from Celery. Then, when processing the requests, you place the execution in a queue that will be executed by this worker.

The fact that you do not need to inform the user about the result does not mean that there is no need to execute asynchronous code. The definition of asynchronous is running in parallel.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.