Skip to content

Commit

Permalink
acquire locks up-front, #201
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
ThrawnCA committed Jan 29, 2024
1 parent 787b5a4 commit e6687a2
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions ckanext/xloader/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()

Expand Down

0 comments on commit e6687a2

Please sign in to comment.