1
0
mirror of https://github.com/netbox-community/netbox.git synced 2024-05-10 07:54:54 +00:00

Introduce constants for RQ queue names

This commit is contained in:
jeremystretch
2022-12-08 09:58:52 -05:00
parent d53ddd611b
commit 6ffd8aa320
4 changed files with 13 additions and 5 deletions

View File

@@ -22,6 +22,7 @@ from extras.constants import *
from extras.conditions import ConditionSet
from extras.utils import FeatureQuery, image_upload
from netbox.config import get_config
from netbox.constants import RQ_QUEUE_DEFAULT
from netbox.models import ChangeLoggedModel
from netbox.models.features import (
CloningMixin, CustomFieldsMixin, CustomLinksMixin, ExportTemplatesMixin, JobResultsMixin, TagsMixin, WebhooksMixin,
@@ -682,7 +683,7 @@ class JobResult(models.Model):
job_id=uuid.uuid4()
)
rq_queue_name = get_config().QUEUE_MAPPINGS.get(obj_type.name, 'default')
rq_queue_name = get_config().QUEUE_MAPPINGS.get(obj_type.name, RQ_QUEUE_DEFAULT)
queue = django_rq.get_queue(rq_queue_name)
if schedule_at:

View File

@@ -6,6 +6,7 @@ from django.utils import timezone
from django_rq import get_queue
from netbox.config import get_config
from netbox.constants import RQ_QUEUE_DEFAULT
from netbox.registry import registry
from utilities.api import get_serializer_for_model
from utilities.utils import serialize_object
@@ -79,7 +80,7 @@ def flush_webhooks(queue):
"""
Flush a list of object representation to RQ for webhook processing.
"""
rq_queue_name = get_config().QUEUE_MAPPINGS.get('webhook', 'default')
rq_queue_name = get_config().QUEUE_MAPPINGS.get('webhook', RQ_QUEUE_DEFAULT)
rq_queue = get_queue(rq_queue_name)
webhooks_cache = {
'type_create': {},