Bugzilla – Attachment 167413 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: (QA follow-up) Slight logic improvement
Bug-34027-QA-follow-up-Slight-logic-improvement.patch (text/plain), 1.95 KB, created by
Martin Renvoize (ashimema)
on 2024-06-04 18:23:43 UTC
(
hide
)
Description:
Bug 34027: (QA follow-up) Slight logic improvement
Filename:
MIME Type:
Creator:
Martin Renvoize (ashimema)
Created:
2024-06-04 18:23:43 UTC
Size:
1.95 KB
patch
obsolete
>From 2d5371d26bf264da2a4c1e18fde01f9c93d042ab Mon Sep 17 00:00:00 2001 >From: Martin Renvoize <martin.renvoize@ptfs-europe.com> >Date: Tue, 4 Jun 2024 19:15:07 +0100 >Subject: [PATCH] Bug 34027: (QA follow-up) Slight logic improvement > >This patch updates the loop to optimize the limit handling > >Signed-off-by: Martin Renvoize <martin.renvoize@ptfs-europe.com> >--- > misc/cronjobs/cleanup_database.pl | 18 ++++++++---------- > 1 file changed, 8 insertions(+), 10 deletions(-) > >diff --git a/misc/cronjobs/cleanup_database.pl b/misc/cronjobs/cleanup_database.pl >index dd4f280355b..e1072d56814 100755 >--- a/misc/cronjobs/cleanup_database.pl >+++ b/misc/cronjobs/cleanup_database.pl >@@ -401,7 +401,7 @@ if ($pLogs) { > DELETE FROM action_logs > WHERE timestamp < date_sub(curdate(), INTERVAL ? DAY) > }; >- my @query_params = (); >+ my @query_params = ($pLogs); > if (@preserve_logs) { > $log_query .= " AND module NOT IN (" . join( ',', ('?') x @preserve_logs ) . ")"; > push @query_params, @preserve_logs; >@@ -421,16 +421,14 @@ if ($pLogs) { > $sth = $dbh->prepare($log_query); > if ($confirm) { > if ($logs_batch) { >- my $counter = 0; >- my $rows = 0; >- while ( $counter <= $rows ) { >- $sth->execute( $pLogs, @query_params ) or die $dbh->errstr; >- sleep 3; >- $rows += $sth->rows; >- $counter += $logs_batch; >- } >+ my $rows_deleted = 0; >+ do { >+ $sth->execute(@query_params) or die $dbh->errstr; >+ $rows_deleted = $sth->rows; >+ sleep 3; # Adjust sleep time as needed >+ } while ( $rows_deleted == $logs_batch ); > } else { >- $sth->execute( $pLogs, @query_params ) or die $dbh->errstr; >+ $sth->execute(@query_params) or die $dbh->errstr; > } > } > print "Done with purging action_logs.\n" if $verbose; >-- >2.45.1
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