Skip to content

Commit 88ba77f

Browse files
committed
feat: propagate MessageGroupId entry on bulk upload
1 parent c8bffa8 commit 88ba77f

File tree

2 files changed

+14
-3
lines changed

2 files changed

+14
-3
lines changed

app/job/rest.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,12 @@ def create_job(service_id):
176176
sender_id = data.get("sender_id")
177177

178178
if job.job_status == JOB_STATUS_PENDING:
179-
process_job.apply_async([str(job.id)], {"sender_id": sender_id}, queue=QueueNames.JOBS)
179+
process_job.apply_async(
180+
[str(job.id)],
181+
{"sender_id": sender_id},
182+
queue=QueueNames.JOBS,
183+
MessageGroupId=str(job.service_id),
184+
)
180185

181186
job_json = job_schema.dump(job)
182187
job_json["statistics"] = []

tests/app/job/test_rest.py

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,10 @@ def test_create_unscheduled_job(client, sample_template, mocker, mock_celery_tas
152152
assert response.status_code == 201
153153

154154
app.celery.tasks.process_job.apply_async.assert_called_once_with(
155-
([str(fake_uuid)]), {"sender_id": None}, queue="job-tasks"
155+
[str(fake_uuid)],
156+
{"sender_id": None},
157+
queue="job-tasks",
158+
MessageGroupId=str(sample_template.service_id),
156159
)
157160

158161
resp_json = json.loads(response.get_data(as_text=True))
@@ -193,7 +196,10 @@ def test_create_unscheduled_job_with_sender_id_in_metadata(
193196
assert response.status_code == 201
194197

195198
app.celery.tasks.process_job.apply_async.assert_called_once_with(
196-
([str(fake_uuid)]), {"sender_id": fake_uuid}, queue="job-tasks"
199+
[str(fake_uuid)],
200+
{"sender_id": fake_uuid},
201+
queue="job-tasks",
202+
MessageGroupId=str(sample_template.service_id),
197203
)
198204

199205

0 commit comments

Comments
 (0)