From 29345650c2b76c6a7dd4e7930ac2f6805bfad17c Mon Sep 17 00:00:00 2001 From: Jeremy Stretch Date: Fri, 24 Apr 2020 15:43:58 -0400 Subject: [PATCH] Standardize import statement as django_rq is no longer optional --- netbox/extras/webhooks.py | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/netbox/extras/webhooks.py b/netbox/extras/webhooks.py index d1d5a59ab..fdf69d6d5 100644 --- a/netbox/extras/webhooks.py +++ b/netbox/extras/webhooks.py @@ -3,11 +3,11 @@ import hmac from django.contrib.contenttypes.models import ContentType from django.utils import timezone +from django_rq import get_queue from extras.models import Webhook from utilities.api import get_serializer_for_model from .choices import * -from .constants import * from .utils import FeatureQuery @@ -50,12 +50,8 @@ def enqueue_webhooks(instance, user, request_id, action): } serializer = serializer_class(instance, context=serializer_context) - # We must only import django_rq if the Webhooks feature is enabled. - # Only if we have gotten to ths point, is the feature enabled - from django_rq import get_queue + # Enqueue the webhooks webhook_queue = get_queue('default') - - # enqueue the webhooks: for webhook in webhooks: webhook_queue.enqueue( "extras.webhooks_worker.process_webhook",