From 79d736020fc12d7fad9f8c1f4d54eb018c33fea6 Mon Sep 17 00:00:00 2001 From: AngryUbuntuNerd Date: Mon, 4 Nov 2024 15:10:51 +0000 Subject: [PATCH] add periodic_task_name to headers --- django_celery_beat/schedulers.py | 1 + t/unit/test_schedulers.py | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/django_celery_beat/schedulers.py b/django_celery_beat/schedulers.py index a73faff3..1da19094 100644 --- a/django_celery_beat/schedulers.py +++ b/django_celery_beat/schedulers.py @@ -78,6 +78,7 @@ def __init__(self, model, app=None): self.options['expires'] = getattr(model, 'expires_') self.options['headers'] = loads(model.headers or '{}') + self.options['headers']['periodic_task_name'] = model.name self.options['periodic_task_name'] = model.name self.total_run_count = model.total_run_count diff --git a/t/unit/test_schedulers.py b/t/unit/test_schedulers.py index f7889c77..2318b645 100644 --- a/t/unit/test_schedulers.py +++ b/t/unit/test_schedulers.py @@ -130,7 +130,7 @@ def test_entry(self): assert e.options['exchange'] == 'foo' assert e.options['routing_key'] == 'cpu' assert e.options['priority'] == 1 - assert e.options['headers'] == {'_schema_name': 'foobar'} + assert e.options['headers'] == {'_schema_name': 'foobar', 'periodic_task_name': m.name} assert e.options['periodic_task_name'] == m.name right_now = self.app.now()