Skip to content

Commit

Permalink
updated celery scheduled tasks for checking if session is expired
Browse files Browse the repository at this point in the history
  • Loading branch information
Naz-iv committed Dec 16, 2023
1 parent 442901d commit 5b02845
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 15 deletions.
16 changes: 10 additions & 6 deletions core/celery.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,16 @@
app.config_from_object(settings, namespace="CELERY")

# Celery Beat Settings
# app.conf.beat_schedule = {
# "check-overdue-task": {
# "task": "borrowing_service.tasks.check_overdue_task",
# "schedule": crontab(minute="*/1"),
# }
# }
app.conf.beat_schedule = {
"check-overdue-task": {
"task": "borrowing_service.tasks.check_overdue_task",
"schedule": crontab(minute="*/1"),
},
"check-payment-session-expiry": {
"task": "payment_service.tasks.verify_session_status",
"schedule": crontab(minute="*/1"),
},
}

# Load task modules from all registered Django apps.
app.autodiscover_tasks()
Expand Down
10 changes: 1 addition & 9 deletions core/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -150,19 +150,11 @@
"ROTATE_REFRESH_TOKENS": False,
}

CELERY_BROKER_URL=os.environ["RABBIT_URL"]
CELERY_BROKER_URL = os.environ["RABBIT_URL"]

#CELERY BEAT
CELERY_BEAT_SCHEDULER = "django_celery_beat.schedulers:DatabaseScheduler"

# Celery schedule for checking is checkout schedule expired
CELERY_SCHEDULE = {
"check-payment-session-expiry": {
"task": "payment_service.tasks.verify_session_status",
"schedule": 60.0,
},
}

STRIPE_SECRET_KEY = os.environ.get("STRIPE_SECRET_KEY")
STRIPE_PUBLISHABLE_KEY = os.environ.get("STRIPE_PUBLISHABLE_KEY")

Expand Down

0 comments on commit 5b02845

Please sign in to comment.