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

Allow redefining internally used queues

This commit is contained in:
kkthxbye-code
2022-12-05 10:04:28 +01:00
committed by Jeremy Stretch
parent 5a77791f9d
commit 080a001118
4 changed files with 23 additions and 2 deletions

View File

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

View File

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