diff --git a/app/celery/scheduled_tasks.py b/app/celery/scheduled_tasks.py index b4937f415d..ad139d42a5 100644 --- a/app/celery/scheduled_tasks.py +++ b/app/celery/scheduled_tasks.py @@ -315,6 +315,17 @@ def beat_inbox_email_bulk(): receipt_id_email, list_of_email_notifications = email_bulk.poll() +if current_app.config["FF_DEBUG_STACK_TRACE"]: + + @notify_celery.task(name="debug-stack-trace") + @statsd(namespace="tasks") + def debug_stack_trace(): + """ + This function, when enabled, will throw an exception so that we can test multi-line logging + """ + raise Exception("Debugging") + + @notify_celery.task(name="beat-inbox-email-priority") @statsd(namespace="tasks") def beat_inbox_email_priority(): @@ -325,6 +336,7 @@ def beat_inbox_email_priority(): to another list(list#2). The heartbeat will then call a job that saves list#2 to the DB and actually sends the email for each notification saved. """ + receipt_id_email, list_of_email_notifications = email_priority.poll() while list_of_email_notifications: diff --git a/app/config.py b/app/config.py index b83e63f9ec..cf9fae7ba4 100644 --- a/app/config.py +++ b/app/config.py @@ -445,6 +445,7 @@ class Config(object): # 'options': {'queue': QueueNames.PERIODIC} # }, } + CELERY_QUEUES: List[Any] = [] CONTACT_FORM_EMAIL_ADDRESS = os.getenv("CONTACT_FORM_EMAIL_ADDRESS", "helpdesk@cds-snc.ca") @@ -525,6 +526,19 @@ class Config(object): # Timestamp in epoch milliseconds to seed the bounce rate. We will seed data for (24, the below config) included. FF_BOUNCE_RATE_SEED_EPOCH_MS = os.getenv("FF_BOUNCE_RATE_SEED_EPOCH_MS", False) + # Feature flag for stack trace debugging + FF_DEBUG_STACK_TRACE = env.bool("FF_DEBUG_STACK_TRACE", False) + if FF_DEBUG_STACK_TRACE: + CELERYBEAT_SCHEDULE.update( + { + "debug-stack-trace": { + "task": "debug-stack-trace", + "schedule": 10, + "options": {"queue": QueueNames.PERIODIC}, + }, + } + ) + @classmethod def get_sensitive_config(cls) -> list[str]: "List of config keys that contain sensitive information"