14132 flush_webhooks -> flush_events

This commit is contained in:
Arthur 2023-10-27 14:58:56 -07:00
parent 4b3b88f23d
commit 91480299ec
4 changed files with 6 additions and 6 deletions

View File

@ -1,7 +1,7 @@
from contextlib import contextmanager from contextlib import contextmanager
from netbox.context import current_request, events_queue from netbox.context import current_request, events_queue
from .webhooks import flush_webhooks from .webhooks import flush_events
@contextmanager @contextmanager
@ -18,7 +18,7 @@ def event_wrapper(request):
yield yield
# Flush queued webhooks to RQ # Flush queued webhooks to RQ
flush_webhooks(events_queue.get()) flush_events(events_queue.get())
# Clear context vars # Clear context vars
current_request.set(None) current_request.set(None)

View File

@ -13,7 +13,7 @@ from dcim.choices import SiteStatusChoices
from dcim.models import Site from dcim.models import Site
from extras.choices import ObjectChangeActionChoices from extras.choices import ObjectChangeActionChoices
from extras.models import Tag, Webhook from extras.models import Tag, Webhook
from extras.webhooks import enqueue_object, flush_webhooks, generate_signature, serialize_for_webhook from extras.webhooks import enqueue_object, flush_events, generate_signature, serialize_for_webhook
from extras.webhooks_worker import eval_conditions, process_webhook from extras.webhooks_worker import eval_conditions, process_webhook
from utilities.testing import APITestCase from utilities.testing import APITestCase
@ -322,7 +322,7 @@ class WebhookTest(APITestCase):
request_id=request_id, request_id=request_id,
action=ObjectChangeActionChoices.ACTION_CREATE action=ObjectChangeActionChoices.ACTION_CREATE
) )
flush_webhooks(events_queue) flush_events(events_queue)
# Retrieve the job from queue # Retrieve the job from queue
job = self.queue.jobs[0] job = self.queue.jobs[0]

View File

@ -77,7 +77,7 @@ def enqueue_object(queue, instance, user, request_id, action):
}) })
def flush_webhooks(queue): def flush_events(queue):
""" """
Flush a list of object representation to RQ for webhook processing. Flush a list of object representation to RQ for webhook processing.
""" """

View File

@ -671,7 +671,7 @@ GRAPHENE = {
# #
# Django RQ (Webhooks backend) # Django RQ (events backend)
# #
if TASKS_REDIS_USING_SENTINEL: if TASKS_REDIS_USING_SENTINEL: