From 588aade8d2720cd2807e4b9520757b3c8af49858 Mon Sep 17 00:00:00 2001 From: Rene Krenn Date: Tue, 4 Dec 2018 01:31:13 +0100 Subject: [PATCH] TT#48198 TT#48196 use ?no_count=true in fraud scripts Change-Id: I96062ad1e9e975fc3fdd51028f84d9e0609b4082 --- bin/ngcp-credit-warning | 6 ++++-- bin/ngcp-fraud-auto-lock | 6 ++++-- bin/ngcp-fraud-daily-lock | 6 ++++-- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/bin/ngcp-credit-warning b/bin/ngcp-credit-warning index 40cef6e..e736e2a 100755 --- a/bin/ngcp-credit-warning +++ b/bin/ngcp-credit-warning @@ -16,6 +16,8 @@ use Email::Sender::Transport::Sendmail qw(); Readonly my @required => qw(); Readonly my $config_file => '/etc/ngcp-panel/provisioning.conf'; +my $page_size = 10; + my $opts = { verbose => 0, }; @@ -105,7 +107,7 @@ sub get_data { $process_code = sub { my $data = shift; return 0; } unless 'CODE' eq ref $process_code; my $client = new NGCP::API::Client; $client->set_verbose($opts->{verbose}); - $client->set_page_rows(10); + $client->set_page_rows($page_size); my @result = (); while (my $res = $client->next_page($uri)) { die $res->result unless $res->is_success; @@ -147,7 +149,7 @@ sub main { die "Missing domain in a credit warning check"; } my @contracts; - get_data(sprintf('/api/customerbalances/?domain=%s&prepaid=1', + get_data(sprintf('/api/customerbalances/?no_count=true&domain=%s&prepaid=1', $cwarning->{domain}), 'customerbalances', sub { diff --git a/bin/ngcp-fraud-auto-lock b/bin/ngcp-fraud-auto-lock index a5c7b9f..a9afb49 100755 --- a/bin/ngcp-fraud-auto-lock +++ b/bin/ngcp-fraud-auto-lock @@ -17,6 +17,8 @@ Readonly my @required => qw(); Readonly my $config_file => '/etc/ngcp-panel/provisioning.conf'; Readonly my $interval => 'month'; +my $page_size = 100; + my $opts = { verbose => 0, }; @@ -60,7 +62,7 @@ sub get_data { my ($uri, $link) = @_; my $client = new NGCP::API::Client; $client->set_verbose($opts->{verbose}); - $client->set_page_rows(10); + $client->set_page_rows($page_size); my @result = (); while (my $res = $client->next_page($uri)) { die $res->result unless $res->is_success; @@ -180,7 +182,7 @@ sub lock_customer { sub main { check_params(); load_config(); - my $events = get_data(sprintf('/api/customerfraudevents/?interval=%s', + my $events = get_data(sprintf('/api/customerfraudevents/?no_count=true&interval=%s', $interval), 'customerfraudevents'); foreach my $event (@{$events}) { diff --git a/bin/ngcp-fraud-daily-lock b/bin/ngcp-fraud-daily-lock index bb2aa14..10c362d 100755 --- a/bin/ngcp-fraud-daily-lock +++ b/bin/ngcp-fraud-daily-lock @@ -17,6 +17,8 @@ Readonly my @required => qw(); Readonly my $config_file => '/etc/ngcp-panel/provisioning.conf'; Readonly my $interval => 'day'; +my $page_size = 100; + my $opts = { verbose => 0, }; @@ -60,7 +62,7 @@ sub get_data { my ($uri, $link) = @_; my $client = new NGCP::API::Client; $client->set_verbose($opts->{verbose}); - $client->set_page_rows(10); + $client->set_page_rows($page_size); my @result = (); while (my $res = $client->next_page($uri)) { die $res->result unless $res->is_success; @@ -180,7 +182,7 @@ sub lock_customer { sub main { check_params(); load_config(); - my $events = get_data(sprintf('/api/customerfraudevents/?interval=%s', + my $events = get_data(sprintf('/api/customerfraudevents/?no_count=true&interval=%s', $interval), 'customerfraudevents'); foreach my $event (@{$events}) {