Files
KeepItGoingServer/config/celery.py
T
Keith SmithandClaude Sonnet 4.5 1d6b07bfed Implement recurring tasks functionality
Adds automatic creation of next task instance when recurring tasks are completed.

- Add calculate_next_due_date() and create_next_recurrence() methods to Task model
- Update task completion handlers in views and sync API to create next recurrence
- Add hourly Celery task to process any missed recurring tasks
- Support daily, weekly, biweekly, monthly, yearly recurrence patterns
- Respect recurrence_end_date limits

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
2026-01-04 10:00:34 -07:00

43 lines
1.1 KiB
Python

"""
Celery configuration for KeepItGoing.
"""
import logging
import os
from celery import Celery
from celery.schedules import crontab
logger = logging.getLogger(__name__)
# Set the default Django settings module
os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'config.settings')
app = Celery('keepitgoing')
# Load config from Django settings
app.config_from_object('django.conf:settings', namespace='CELERY')
# Auto-discover tasks in all installed apps
app.autodiscover_tasks()
# Celery Beat schedule for periodic tasks
app.conf.beat_schedule = {
'send-due-reminders': {
'task': 'notifications.tasks.send_due_reminders',
'schedule': crontab(minute='*/5'), # Every 5 minutes
},
'check-overdue-tasks': {
'task': 'notifications.tasks.check_overdue_tasks',
'schedule': crontab(hour=8, minute=0), # Daily at 8 AM
},
'process-recurring-tasks': {
'task': 'notifications.tasks.process_recurring_tasks',
'schedule': crontab(minute=0), # Every hour
},
}
@app.task(bind=True)
def debug_task(self):
logger.debug(f'Request: {self.request!r}')