From 720018b09785d49f760380c85e187243c7b61fd8 Mon Sep 17 00:00:00 2001 From: Jacob Nesbitt Date: Fri, 19 Jul 2024 15:46:45 -0400 Subject: [PATCH] Use select_for_update when updating dandiset version --- dandiapi/api/services/embargo/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dandiapi/api/services/embargo/__init__.py b/dandiapi/api/services/embargo/__init__.py index 2ad9a8aca..b4c2c1aab 100644 --- a/dandiapi/api/services/embargo/__init__.py +++ b/dandiapi/api/services/embargo/__init__.py @@ -90,7 +90,7 @@ def unembargo_dandiset(ds: Dandiset): # Fetch version to ensure changed embargo_status is included # Save version to update metadata through populate_metadata - v = Version.objects.get(dandiset=ds, version='draft') + v = Version.objects.select_for_update().get(dandiset=ds, version='draft') v.save() logger.info('Version metadata updated')