From 18ba37047503d6473344277a39ea049bb1b0fdef Mon Sep 17 00:00:00 2001 From: Rene Krenn Date: Wed, 3 Sep 2025 14:56:23 +0200 Subject: [PATCH] MT#63507 fix delete_loop copying records to next month table commit 74f22addc intruduced a bug that results in copying eg. july CDRs into august backup table. datetime obejcts are not immutable, so clone it before modifying. Change-Id: I12a52b1de7f4f5f68397148cd206035d2ac0b6b7 --- lib/NGCP/Cleanup.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/NGCP/Cleanup.pm b/lib/NGCP/Cleanup.pm index c2a3c79..b2cd103 100644 --- a/lib/NGCP/Cleanup.pm +++ b/lib/NGCP/Cleanup.pm @@ -493,7 +493,7 @@ sub delete_loop { my $col_mode = $self->env('time-column-mode'); my $mstart = $bm->strftime('%Y-%m-01 00:00:00'); - my $mend = $bm->add(months => 1)->strftime('%Y-%m-%d %H:%M:%S'); + my $mend = $bm->clone->add(months => 1)->strftime('%Y-%m-%d %H:%M:%S'); my $mtable = $table . '_' . $bm->strftime('%Y%m'); $self->debug("table=$table backup=$mtable");