django-background-tasks icon indicating copy to clipboard operation
django-background-tasks copied to clipboard

Need a global shutoff setting.

Open JnBrymn opened this issue 4 years ago • 2 comments

For the purposes of testing and debugging it would be useful to have a global shutoff value that would cause all @background decorated tasks to run synchronously. Celery has this with it's task-always-eager setting.

I'm probably being naive, but an easy fix would be, on this line stick

if os.environ('TASK_ALWAYS_EAGER') == 'TRUE':
    return self.task_function()

JnBrymn avatar May 08 '20 03:05 JnBrymn

This is a good idea.

Maybe the env variable name should be defined in the settings.py.

Another option is a file. If present, ...

philippeowagner avatar Jun 30 '20 14:06 philippeowagner

Seems like this is a duplicate of #176

schmave avatar Jan 18 '21 16:01 schmave