Bugzilla – Attachment 172546 Details for
Bug 34027
Add functionality to cleanup_database.pl to purge action logs in batches
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
Bug 34027: (follow-up) Make sleep seconds a command-line param
Bug-34027-follow-up-Make-sleep-seconds-a-command-l.patch (text/plain), 3.26 KB, created by
Kyle M Hall (khall)
on 2024-10-08 18:00:50 UTC
(
hide
)
Description:
Bug 34027: (follow-up) Make sleep seconds a command-line param
Filename:
MIME Type:
Creator:
Kyle M Hall (khall)
Created:
2024-10-08 18:00:50 UTC
Size:
3.26 KB
patch
obsolete
>From 1cdb7c653fc7e405021337c5e3dffd5593cc8e2e Mon Sep 17 00:00:00 2001 >From: Aleisha Amohia <aleishaamohia@hotmail.com> >Date: Tue, 8 Oct 2024 02:20:12 +0000 >Subject: [PATCH] Bug 34027: (follow-up) Make sleep seconds a command-line > param > >Use --logs-sleep SECONDS to specify how many seconds Koha should wait between batches when deleting action logs. > >Defaults to 3 > >Sponsored-by: Auckland University of Technology >Sponsored-by: Catalyst IT > >Signed-off-by: Kyle M Hall <kyle@bywatersolutions.com> >--- > misc/cronjobs/cleanup_database.pl | 7 ++++++- > 1 file changed, 6 insertions(+), 1 deletion(-) > >diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl >index 7af1088b431..2aedddf8302 100755 >--- a/misc/cronjobs/cleanup_database.pl >+++ b/misc/cronjobs/cleanup_database.pl >@@ -31,6 +31,7 @@ use constant DEFAULT_JOBS_PURGEDAYS => 1; > use constant DEFAULT_JOBS_PURGETYPES => qw{ update_elastic_index }; > use constant DEFAULT_EDIFACT_MSG_PURGEDAYS => 365; > use constant DEFAULT_LOGS_BATCHSIZE => 1000; >+use constant DEFAULT_LOGS_BATCHSLEEP => 3; > > use Getopt::Long qw( GetOptions ); > >@@ -90,6 +91,7 @@ Usage: $0 [-h|--help] [--confirm] [--sessions] [--sessdays DAYS] [-v|--verbose] > Defaults to 180 days if no days specified. > --logs-batch ROWS Delete action_logs rows in batches of ROWS. Ignored if --logs is not set. > Defaults to 1000. >+ --logs-sleep SECS Sleeps for SECS seconds between each batch of action_logs rows deleted. Defaults to 3. > --searchhistory DAYS purge entries from search_history older than DAYS days. > Defaults to 30 days if no days specified > --list-invites DAYS purge (unaccepted) list share invites older than DAYS days. >@@ -175,6 +177,7 @@ my @jobs_types; > my $reports; > my $edifact_msg_days; > my $logs_batch; >+my $logs_sleep = 3; > > my $command_line_options = join( " ", @ARGV ); > >@@ -223,6 +226,7 @@ GetOptions( > 'reports:i' => \$reports, > 'edifact-messages:i' => \$edifact_msg_days, > 'logs-batch:i' => \$logs_batch, >+ 'logs-sleep:i' => \$logs_sleep, > ) || usage(1); > > # Use default values >@@ -238,6 +242,7 @@ $jobs_days = DEFAULT_JOBS_PURGEDAYS if defined($jobs_days) > @jobs_types = (DEFAULT_JOBS_PURGETYPES) if $jobs_days && @jobs_types == 0; > $edifact_msg_days = DEFAULT_EDIFACT_MSG_PURGEDAYS if defined($edifact_msg_days) && $edifact_msg_days == 0; > $logs_batch = DEFAULT_LOGS_BATCHSIZE if defined($logs_batch) && $logs_batch == 0; >+$logs_sleep = DEFAULT_LOGS_BATCHSLEEP if defined($logs_sleep) && $logs_sleep == 0; > > # Choose the number of days at which to purge unaccepted list invites: > # - DAYS defined in the list-invites parameter is prioritised first >@@ -429,7 +434,7 @@ if ($pLogs) { > do { > $sth->execute(@query_params) or die $dbh->errstr; > $rows_deleted = $sth->rows; >- sleep 3; # Adjust sleep time as needed >+ sleep $logs_sleep; > } while ( $rows_deleted == $logs_batch ); > } else { > $sth->execute(@query_params) or die $dbh->errstr; >-- >2.39.5 (Apple Git-154)
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
|
Splinter Review
Attachments on
bug 34027
:
152394
|
152395
|
167407
|
167408
|
167412
|
167413
|
167414
|
172506
|
172543
|
172544
|
172545
| 172546 |
172547