14132 optimize flush_events

This commit is contained in:
Arthur 2023-11-15 08:34:41 -08:00
parent a2f542774d
commit 12b4bf80bc

View File

@ -137,9 +137,10 @@ def flush_events(queue):
"""
Flush a list of object representation to RQ for webhook processing.
"""
for name in settings.NETBOX_EVENTS_PIPELINE:
try:
func = module_member(name)
func(queue)
except Exception as e:
logger.error(f"Cannot import events pipeline {name} error: {e}")
if queue:
for name in settings.NETBOX_EVENTS_PIPELINE:
try:
func = module_member(name)
func(queue)
except Exception as e:
logger.error(f"Cannot import events pipeline {name} error: {e}")