Short circuit notifications when not enabled
Wasting time on generating the payload of the notifications is unnecessary if the notification will not be emitted due to configuration. This patch depends on an oslo messaging improvement that adds a way to check if a Notifier will emit the notification or not. Depends-On: Ib992f5c20fef85224fb00823e1d8d9c6cff19bec Depends-On: I979fb3385671aba6f4162ef991da8f0febe0068a Change-Id: I3e6741d59df49e1e58409314008c2ed609fdedc1
This commit is contained in:

committed by
melanie witt

parent
1e0e4080fb
commit
29cb8f1c45
@@ -20,6 +20,7 @@ import nova.conf
|
||||
from nova.notifications.objects import base
|
||||
from nova.notifications.objects import exception
|
||||
from nova.objects import fields
|
||||
from nova import rpc
|
||||
from nova import safe_utils
|
||||
|
||||
CONF = nova.conf.CONF
|
||||
@@ -32,6 +33,7 @@ def _emit_exception_notification(notifier, context, ex, function_name, args,
|
||||
_emit_versioned_exception_notification(context, ex, binary)
|
||||
|
||||
|
||||
@rpc.if_notifications_enabled
|
||||
def _emit_versioned_exception_notification(context, ex, binary):
|
||||
versioned_exception_payload = exception.ExceptionPayload.from_exception(ex)
|
||||
publisher = base.NotificationPublisher(context=context, host=CONF.host,
|
||||
|
Reference in New Issue
Block a user