You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
24 lines
1.0 KiB
24 lines
1.0 KiB
from django.apps import AppConfig
|
|
|
|
class TournamentsConfig(AppConfig):
|
|
name = 'tournaments'
|
|
default_auto_field = 'django.db.models.BigAutoField'
|
|
|
|
def ready(self):
|
|
import tournaments.signals # This will ensure the signals are registered
|
|
# Start background tasks in production
|
|
# Schedule background tasks on startup
|
|
from django.conf import settings
|
|
if not settings.DEBUG: # Only in production
|
|
try:
|
|
from background_task.models import Task
|
|
from tournaments.tasks import check_confirmation_deadlines
|
|
|
|
# Clear existing tasks first to avoid duplicates
|
|
Task.objects.filter(task_name='tournaments.tasks.check_confirmation_deadlines').delete()
|
|
|
|
# Schedule the task to run every 30 minutes (1800 seconds)
|
|
check_confirmation_deadlines(repeat=settings.BACKGROUND_TASK_REPEAT_INTERVAL * 60)
|
|
except:
|
|
# Handle exceptions during startup
|
|
pass
|
|
|