Skip to content

Commit

Permalink
Avoid a potential race condition (#1156)
Browse files Browse the repository at this point in the history
Issue: AAH-1384
  • Loading branch information
bmclaughlin authored Mar 4, 2022
1 parent ee345e7 commit 5770462
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 4 deletions.
8 changes: 8 additions & 0 deletions .ci/scripts/extra_linting.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

EXIT_CODE=0
if (git grep "orphan_protection_time=0" ./galaxy_ng);then
echo "Setting 'orphan_protection_time' to 0 can lead to a race condition.\n";
EXIT_CODE=1
fi
exit $EXIT_CODE
2 changes: 1 addition & 1 deletion .github/template_gitref
Original file line number Diff line number Diff line change
@@ -1 +1 @@
2021.08.26-83-g29b161f
2021.08.26-85-ga3934fa
3 changes: 3 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,9 @@ jobs:
- name: Run flake8
run: flake8 --config flake8.cfg

- name: Run extra lint checks
run: "[ -x .ci/scripts/extra_linting.sh ] && .ci/scripts/extra_linting.sh"

# check for any files unintentionally left out of MANIFEST.in
- name: Check manifest
run: check-manifest
Expand Down
1 change: 1 addition & 0 deletions CHANGES/1384.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Make sure orphan_protection_time is not set to zero
6 changes: 3 additions & 3 deletions galaxy_ng/app/tasks/deletion.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def delete_collection_version(collection_version_pk):
_remove_collection_version_from_repos(collection_version)

log.info("Running orphan_cleanup to delete CollectionVersion object and artifact")
orphan_cleanup(content_pks=None, orphan_protection_time=0)
orphan_cleanup(content_pks=None, orphan_protection_time=10)

if not collection.versions.all():
log.info("Collection has no more versions, deleting collection {}".format(collection))
Expand All @@ -78,7 +78,7 @@ def delete_collection(collection_pk):
_remove_collection_version_from_repos(version)

log.info("Running orphan_cleanup to delete CollectionVersion objects and artifacts")
orphan_cleanup(content_pks=None, orphan_protection_time=0)
orphan_cleanup(content_pks=None, orphan_protection_time=10)

log.info("Deleting collection {}".format(collection))
collection.delete()
Expand All @@ -91,7 +91,7 @@ def delete_container_distribution(instance_ids):
general_multi_delete(instance_ids=instance_ids)

log.info("Running orphan_cleanup to delete Container objects and artifacts")
orphan_cleanup(content_pks=None, orphan_protection_time=0)
orphan_cleanup(content_pks=None, orphan_protection_time=10)


def delete_container_image_manifest(repository_pk, content_unit_pks):
Expand Down

0 comments on commit 5770462

Please sign in to comment.