Skip to content

Commit

Permalink
Always add current domain as a shared resource
Browse files Browse the repository at this point in the history
fixes: #4285
  • Loading branch information
gerrod3 authored and ipanova committed Aug 17, 2023
1 parent c9c1a5b commit 89d37d1
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGES/plugin_api/4285.feature
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Made the current domain a shared resource for all tasks even with domains disabled, so tasks can
hold off all other operations by taking an exclusive lock on the (default) domain.
10 changes: 5 additions & 5 deletions pulpcore/tasking/tasks.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
import traceback
import sys

from django.conf import settings
from django.db import transaction, connection
from django.db.models import Model, Q
from django.utils import timezone
Expand Down Expand Up @@ -153,10 +152,11 @@ def dispatch(
shared_resources = []
else:
shared_resources = _validate_and_get_resources(shared_resources)
if settings.DOMAIN_ENABLED:
domain_url = get_url(get_domain())
if domain_url not in exclusive_resources:
shared_resources.append(domain_url)

# A task that is exclusive on a domain will block all tasks within that domain
domain_url = get_url(get_domain())
if domain_url not in exclusive_resources:
shared_resources.append(domain_url)
resources = exclusive_resources + [f"shared:{resource}" for resource in shared_resources]

notify_workers = False
Expand Down

0 comments on commit 89d37d1

Please sign in to comment.