Fix ignored [notification] batch_size

The [notification] batch_size parameter has had no effect since
workload partitioning was removed during Stein cycle[1]. This change
fixes the ignored parameter and ensure the parameter is used to enable
batch processing of notifications.

[1] 9d90ce8d37

Change-Id: Id46679933cf96ecaca864aeae271052386b51815
This commit is contained in:
Takashi Kajinami 2021-11-12 19:19:23 +09:00
parent 4d2ad5bc7a
commit ec5b90e98f
3 changed files with 21 additions and 4 deletions

View File

@ -44,10 +44,13 @@ OPTS = [
"notifications go to rabbit-nova:5672, while all "
"cinder notifications go to rabbit-cinder:5672."),
cfg.IntOpt('batch_size',
default=100, min=1,
default=1, min=1,
help='Number of notification messages to wait before '
'publishing them. Batching is advised when transformations are '
'applied in pipeline.'),
'publishing them.'),
cfg.IntOpt('batch_timeout',
help='Number of seconds to wait before dispatching samples '
'when batch_size is not reached (None means indefinitely).'
),
cfg.IntOpt('workers',
default=1,
min=1,
@ -138,7 +141,9 @@ class NotificationService(cotyledon.Service):
# NOTE(gordc): ignore batching as we want pull
# to maintain sequencing as much as possible.
listener = messaging.get_batch_notification_listener(
transport, targets, endpoints, allow_requeue=True)
transport, targets, endpoints, allow_requeue=True,
batch_size=self.conf.notification.batch_size,
batch_timeout=self.conf.notification.batch_timeout)
listener.start(
override_pool_size=self.conf.max_parallel_requests
)

View File

@ -0,0 +1,5 @@
---
deprecations:
- |
The ``[notification] batch_size`` parameter has been deprecated.
The parameter has not used since the Stein release.

View File

@ -0,0 +1,7 @@
---
fixes:
- |
The ``[notification] batch_size`` parameter now takes effect to enable
batch processing of notifications. The ``[notification] batch_timeout``
parameter has been restored at the same time to determine how much and
how long notifications are kept.