From 8d653b30e5699de7c0053ca7971c22d60b10bc48 Mon Sep 17 00:00:00 2001 From: Florent Chehab Date: Thu, 4 Jun 2026 11:39:34 +0200 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B5(backend)=20improve=20robustness=20?= =?UTF-8?q?of=20the=20delete=20file=20process?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Make the call the delete celery task after the transaction this makes sure the file object is in the right state before being deleted. --- src/backend/core/api/viewsets.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/backend/core/api/viewsets.py b/src/backend/core/api/viewsets.py index c3dd1b2b..f56dae11 100644 --- a/src/backend/core/api/viewsets.py +++ b/src/backend/core/api/viewsets.py @@ -1326,7 +1326,7 @@ class FileViewSet( """Delete a file completely.""" file.soft_delete() file.hard_delete() - process_file_deletion.delay(file.id) + transaction.on_commit(lambda: process_file_deletion.delay(file.id)) def _authorize_subrequest(self, request, pattern): """