Skip to content

Commit 2fd23f3

Browse files
Fixes: #17648 - Fix exception thrown in Job.delete() when no object_type specified (#17657)
* Fixes: #17648 - Fix exception thrown in `Job.delete()` when no object_type specified * Remove unrelated fix * Change back elif to if * Remove unused imports --------- Co-authored-by: Jeremy Stretch <[email protected]>
1 parent 364826d commit 2fd23f3

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

netbox/core/models/jobs.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,6 @@
1313
from core.choices import JobStatusChoices
1414
from core.models import ObjectType
1515
from core.signals import job_end, job_start
16-
from netbox.config import get_config
17-
from netbox.constants import RQ_QUEUE_DEFAULT
1816
from utilities.querysets import RestrictedQuerySet
1917
from utilities.rqworker import get_queue_for_model
2018

@@ -155,7 +153,7 @@ def duration(self):
155153
def delete(self, *args, **kwargs):
156154
super().delete(*args, **kwargs)
157155

158-
rq_queue_name = get_config().QUEUE_MAPPINGS.get(self.object_type.model, RQ_QUEUE_DEFAULT)
156+
rq_queue_name = get_queue_for_model(self.object_type.model if self.object_type else None)
159157
queue = django_rq.get_queue(rq_queue_name)
160158
job = queue.fetch_job(str(self.job_id))
161159

0 commit comments

Comments
 (0)