lilspikey / django-background-task

A database-backed work queue for Django
BSD 3-Clause "New" or "Revised" License
107 stars 207 forks source link

Add shortcut `now` to launch background function right now #17

Closed Zagrebelin closed 8 years ago

Zagrebelin commented 8 years ago

Add ability to launch background task right now as normal function:

from background_task import background
@background
def add(x,y):
    return x+y

add(2, 2)      # create a task 
add.now(2, 2)  # launch it right now and got answer 4.

Today we can do it using add.task_function(2,2) but proposed now shortcut is cleaner and simpler.

lilspikey commented 8 years ago

Ok, that's a simple enough change. I've check that the tests still run OK and merged it in.

Perhaps you might want to add a small note in the documentation about this? As it might be useful for others?