Skip to content

Commit c7e3100

Browse files
authored
fix: update id parameter name in celery-v2 headers (#433)
* fix: update id parameter name in celery-v2 headers
1 parent e0ec63d commit c7e3100

File tree

4 files changed

+14
-6
lines changed

4 files changed

+14
-6
lines changed

CHANGELOG.rst

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,14 @@ Change Log
1313
1414
Unreleased
1515
~~~~~~~~~~
16+
17+
[3.4.3] - 2025-08-06
18+
~~~~~~~~~~~~~~~~~~~~
19+
20+
Fixed
21+
+++++
22+
* Fix Celery protocol v2 header parameter name from ``task_id`` to ``id`` in ``extract_proto2_headers`` function
23+
1624
[3.4.2] - 2025-06-24
1725
~~~~~~~~~~~~~~~~~~~~
1826

tests/test_signals.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -202,7 +202,7 @@ def test_create_user_task_protocol_v2(self):
202202
{'callbacks': [], 'errbacks': [], 'task_chain': None, 'chord': None}
203203
)
204204
headers = {
205-
'task_id': 'tid', 'retries': 0, 'eta': None, 'expires': None,
205+
'id': 'tid', 'retries': 0, 'eta': None, 'expires': None,
206206
'group': None, 'timelimit': [None, None], 'task': 'test_signals.sample_task'
207207
}
208208
create_user_task(sender='test_signals.sample_task', body=body, headers=headers)
@@ -565,7 +565,7 @@ class TestUtils:
565565

566566
def test_extract_proto2_headers(self):
567567
headers = extract_proto2_headers(
568-
task_id='abc123', retries=2, eta='2025-05-30T12:00:00',
568+
id='abc123', retries=2, eta='2025-05-30T12:00:00',
569569
expires=None, group='group1', timelimit=[10, 20],
570570
task='my_task', extra='ignored')
571571
assert headers == {
@@ -609,7 +609,7 @@ def test_proto2_to_proto1(self, monkeypatch):
609609
'task_chain': ['a'], 'chord': 'ch'}
610610
)
611611
headers = {
612-
'task_id': 'tid', 'retries': 1, 'eta': 'eta', 'expires': 'exp',
612+
'id': 'tid', 'retries': 1, 'eta': 'eta', 'expires': 'exp',
613613
'group': 'grp', 'timelimit': [1, 2], 'task': 't',
614614
'extra': 'ignored'
615615
}

user_tasks/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44

55
from django.dispatch import Signal
66

7-
__version__ = '3.4.2'
7+
__version__ = '3.4.3'
88

99

1010
# This signal is emitted when a user task reaches any final state:

user_tasks/utils.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,12 +23,12 @@ def proto2_to_proto1(body, headers):
2323
return new_body
2424

2525

26-
def extract_proto2_headers(task_id, retries, eta, expires, group, timelimit, task, **_):
26+
def extract_proto2_headers(id, retries, eta, expires, group, timelimit, task, **_): # pylint: disable=redefined-builtin
2727
"""
2828
Extract relevant headers from protocol v2 format.
2929
"""
3030
return {
31-
"id": task_id,
31+
"id": id,
3232
"task": task,
3333
"retries": retries,
3434
"eta": eta,

0 commit comments

Comments
 (0)