diff --git a/manifests/expirer.pp b/manifests/expirer.pp index 01c5b2e..cddc51d 100644 --- a/manifests/expirer.pp +++ b/manifests/expirer.pp @@ -25,13 +25,18 @@ # [*weekday*] # (optional) Defaults to '*'. # +# [*events_delete_batch_size*] +# (optional) Limit number of deleted events in single purge run. +# Defaults to $::os_service_default. +# class panko::expirer ( - $enable_cron = true, - $minute = 1, - $hour = 0, - $monthday = '*', - $month = '*', - $weekday = '*', + $enable_cron = true, + $minute = 1, + $hour = 0, + $monthday = '*', + $month = '*', + $weekday = '*', + $events_delete_batch_size = $::os_service_default, ) { include panko::params @@ -45,6 +50,10 @@ class panko::expirer ( $ensure = 'absent' } + panko_config { 'database/events_delete_batch_size': + value => $events_delete_batch_size + } + cron { 'panko-expirer': ensure => $ensure, command => $panko::params::expirer_command, diff --git a/releasenotes/notes/batchsize-9f201b538828370d.yaml b/releasenotes/notes/batchsize-9f201b538828370d.yaml new file mode 100644 index 0000000..2a0a83f --- /dev/null +++ b/releasenotes/notes/batchsize-9f201b538828370d.yaml @@ -0,0 +1,6 @@ +--- +features: + - | + Added events_delete_batch_size parameter to the expirer class to enable configuration + of the parameter with same name. It serves the purpose of limiting number of deleted + events in single purge run. diff --git a/spec/classes/panko_expirer_spec.rb b/spec/classes/panko_expirer_spec.rb index b46fa19..2132452 100644 --- a/spec/classes/panko_expirer_spec.rb +++ b/spec/classes/panko_expirer_spec.rb @@ -9,6 +9,7 @@ describe 'panko::expirer' do context 'with default' do it { is_expected.to contain_class('panko::deps') } it { is_expected.to contain_class('panko::params') } + it { is_expected.to contain_panko_config('database/events_delete_batch_size').with_value('') } it { is_expected.to contain_cron('panko-expirer').with( :ensure => 'present', @@ -23,6 +24,18 @@ describe 'panko::expirer' do )} end + context 'with overridden parameters' do + before do + params.merge!( + :events_delete_batch_size => 500 + ) + end + + it { is_expected.to contain_class('panko::deps') } + it { is_expected.to contain_class('panko::params') } + it { is_expected.to contain_panko_config('database/events_delete_batch_size').with_value(500) } + end + context 'with cron not enabled' do before do params.merge!( :enable_cron => false )