mirror of
https://github.com/netbox-community/netbox.git
synced 2025-08-23 16:06:43 -06:00
14132 flush_webhooks -> flush_events
This commit is contained in:
parent
4b3b88f23d
commit
91480299ec
@ -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)
|
||||||
|
@ -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]
|
||||||
|
@ -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.
|
||||||
"""
|
"""
|
||||||
|
@ -671,7 +671,7 @@ GRAPHENE = {
|
|||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Django RQ (Webhooks backend)
|
# Django RQ (events backend)
|
||||||
#
|
#
|
||||||
|
|
||||||
if TASKS_REDIS_USING_SENTINEL:
|
if TASKS_REDIS_USING_SENTINEL:
|
||||||
|
Loading…
Reference in New Issue
Block a user