From 5a7a73e3ee6b7b974ffe8362910508a2e14a4901 Mon Sep 17 00:00:00 2001 From: Galen Charlton Date: Mon, 23 Mar 2015 19:20:50 +0000 Subject: [PATCH] grab values from settings service Signed-off-by: Galen Charlton --- Open-ILS/src/reporter/clark-kent.pl | 33 +++++++++++++++++++++++---------- 1 file changed, 23 insertions(+), 10 deletions(-) diff --git a/Open-ILS/src/reporter/clark-kent.pl b/Open-ILS/src/reporter/clark-kent.pl index 27bbc28b6a..d460d296f5 100755 --- a/Open-ILS/src/reporter/clark-kent.pl +++ b/Open-ILS/src/reporter/clark-kent.pl @@ -29,21 +29,19 @@ use Email::Send; use open ':utf8'; -my ($count, $config, $sleep_interval, $lockfile, $daemon) = (1, 'SYSCONFDIR/opensrf_core.xml', 10, '/tmp/reporter-LOCK'); +my ($opt_count, $config, $sleep_interval, $lockfile, $daemon) = (1, 'SYSCONFDIR/opensrf_core.xml', 10, '/tmp/reporter-LOCK'); -# set upper bound on number of rows in the resultset -# before Clark refuses to try to draw a chart -my $max_rows_for_charts = 1000; -my $statement_timeout = 60; -my $resultset_limit; +my $opt_max_rows_for_charts; +my $opt_statement_timeout; +my $opt_resultset_limit; GetOptions( "daemon" => \$daemon, "sleep=i" => \$sleep_interval, - "concurrency=i" => \$count, - "max-rows-for-charts=i" => \$max_rows_for_charts, - "resultset-limit=i" => \$resultset_limit, - "statement-timeout=i" => \$statement_timeout, + "concurrency=i" => \$opt_count, + "max-rows-for-charts=i" => \$opt_max_rows_for_charts, + "resultset-limit=i" => \$opt_resultset_limit, + "statement-timeout=i" => \$opt_statement_timeout, "bootstrap|boostrap=s" => \$config, "lockfile=s" => \$lockfile, ); @@ -97,6 +95,21 @@ my $base_uri = $sc->config_value( reporter => setup => 'base_uri' ); my $state_dsn = "dbi:" . $state_db{db_driver} . ":dbname=" . $state_db{db_name} .';host=' . $state_db{db_host} . ';port=' . $state_db{db_port}; my $data_dsn = "dbi:" . $data_db{db_driver} . ":dbname=" . $data_db{db_name} .';host=' . $data_db{db_host} . ';port=' . $data_db{db_port}; +my $count = $opt_count // + $sc->config_value( reporter => setup => 'parallel' ) // + 1; +$count = 1 unless $count =~ /^\d+$/ && $count > 0; +my $statement_timeout = $opt_statement_timeout // + $sc->config_value( reporter => setup => 'statement_timeout' ) // + 60; +$statement_timeout = 60 unless $statement_timeout =~ /^\d+$/; +my $max_rows_for_charts = $opt_max_rows_for_charts // + $sc->config_value( reporter => setup => 'max_rows_for_charts' ) // + 1000; +$max_rows_for_charts = 1000 unless $max_rows_for_charts =~ /^\d+$/; +my $resultset_limit = $opt_resultset_limit // + $sc->config_value( reporter => setup => 'resultset_limit' ); + my ($dbh,$running,$sth,@reports,$run, $current_time); if ($daemon) { -- 2.11.0