jeudi 22 octobre 2020

Pattern where python django view would respond back with 'Task still running' if the task take longer than a specified time

This is not about async or long-running job that can be run through Celery. Not often, but a few times, some of our web requests take longer, and if the Django view is still processing, our gateway will return a time-out to the front-end.

I am looking for any established pattern in django where we can return the response saying 'Task still running' (HTTP code 100 or 102) if it goes beyond a certain time, but the task/thread continues execution. This way, we can handle the UI in front-end through some messaging, instead of giving an API time-out experience returned by our gateway. I am not looking for polling or the API sending another response, it just returns 102 response, but let the actual task execution continue.

Aucun commentaire:

Enregistrer un commentaire