mirror of
https://github.com/jazzband/django-defender.git
synced 2026-04-24 16:54:47 +00:00
dynamic load celery (#163)
This commit is contained in:
parent
df0b9db26f
commit
6354df0a8a
1 changed files with 5 additions and 6 deletions
|
|
@ -1,12 +1,7 @@
|
|||
from .data import store_login_attempt
|
||||
|
||||
# not sure how to get this to look better. ideally we want to dynamically
|
||||
# apply the celery decorator based on the USE_CELERY setting.
|
||||
|
||||
from celery import shared_task
|
||||
from . import config
|
||||
|
||||
|
||||
@shared_task()
|
||||
def add_login_attempt_task(
|
||||
user_agent, ip_address, username, http_accept, path_info, login_valid
|
||||
):
|
||||
|
|
@ -14,3 +9,7 @@ def add_login_attempt_task(
|
|||
store_login_attempt(
|
||||
user_agent, ip_address, username, http_accept, path_info, login_valid
|
||||
)
|
||||
|
||||
if config.USE_CELERY:
|
||||
from celery import shared_task
|
||||
add_login_attempt_task = shared_task(add_login_attempt_task)
|
||||
|
|
|
|||
Loading…
Reference in a new issue