From e6687a280aafc3c2fdba367fa04c290df3ac04dd Mon Sep 17 00:00:00 2001 From: ThrawnCA Date: Mon, 29 Jan 2024 17:40:29 +1000 Subject: [PATCH] acquire locks up-front, #201 - Request a write-lock when preparing to update resource metadata, not just a read lock, so that we don't risk deadlocking with another process. --- ckanext/xloader/utils.py | 1 + 1 file changed, 1 insertion(+) diff --git a/ckanext/xloader/utils.py b/ckanext/xloader/utils.py index ec8e4bbd..e504a738 100644 --- a/ckanext/xloader/utils.py +++ b/ckanext/xloader/utils.py @@ -83,6 +83,7 @@ def set_resource_metadata(update_dict): # better fix q = model.Session.query(model.Resource). \ + with_for_update(of=model.Resource). \ filter(model.Resource.id == update_dict['resource_id']) resource = q.one()