Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WIP: Add background async task runner #10695

Closed
wants to merge 3 commits into from
Closed

WIP: Add background async task runner #10695

wants to merge 3 commits into from

Conversation

sultaniman
Copy link

Hi,

This PR ports background task runner from Responder
and Starlette.

Use case example

from django.utils import background

@background.task
def my_task():
    # Do some work

def hello(request):
    my_task()  # Call task to execute in background

    render(request, template)

This is still WIP PR so please give you reviews so I can adjust things.

Thanks.

@vsag96
Copy link

vsag96 commented Nov 27, 2018

Looks amazing, just a suggestion, why not have the no of workers equal to the number of cores like celery? Thank you for this.

@timgraham
Copy link
Member

I don't see why this needs to be part of Django instead of a third-party package. Generally, we don't add anything to django.utils that Django itself doesn't use. Anyway, the first step is to get consensus on our new feature on the django-developers mailing list.

@timgraham timgraham closed this Nov 27, 2018
@sultaniman sultaniman deleted the feat/background-task-runner branch November 27, 2018 14:15
@sultaniman
Copy link
Author

Fair points. Thanks for feedback. I believe Django core team should move mailing list into GitHub issues.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants