Skip to content

Commit 850621f

Browse files
fix: make call to cleanup_blobs task immutable
and ignore results
1 parent c2c903d commit 850621f

File tree

3 files changed

+5
-10
lines changed

3 files changed

+5
-10
lines changed

sketch_map_tool/routes.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ def digitize_results_post(lang="en") -> Response:
163163
group_ = group([task_1, task_2])
164164
chain_ = chain(
165165
group_,
166-
cleanup_blobs.signature(kwargs={"map_frame_uuids": list(set(uuids))}),
166+
cleanup_blobs.signature([list(set(uuids))], immutable=True),
167167
)
168168
chain_result = chain_.apply_async()
169169

sketch_map_tool/tasks.py

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -235,12 +235,7 @@ def cleanup_map_frames():
235235
return True
236236

237237

238-
@celery.task
239-
def cleanup_blobs(*_, file_ids: list[int]):
240-
"""Cleanup uploaded files stored in the database.
241-
242-
Arguments are ignored. They are only part of the signature because of the usage in
243-
a celery chain.
244-
"""
238+
@celery.task(ignore_result=True)
239+
def cleanup_blobs(file_ids: list[int]):
240+
"""Cleanup uploaded files stored in the database."""
245241
db_client_celery.cleanup_blob(file_ids)
246-
return True

tests/integration/test_celery_tasks.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,5 +46,5 @@ def test_cleanup_blobs(uuid_create, flask_app):
4646
with client_flask.open_connection().cursor() as curs:
4747
curs.execute("SELECT id FROM blob WHERE map_frame_uuid = %s", [uuid_create])
4848
file_ids = curs.fetchall()[0]
49-
task = tasks.cleanup_blobs.apply_async(kwargs={"file_ids": file_ids})
49+
task = tasks.cleanup_blobs.apply_async(file_ids)
5050
task.wait()

0 commit comments

Comments
 (0)