From 278e869d57e7822a94899b5b257ae78729be5afb Mon Sep 17 00:00:00 2001 From: Tom Molesworth Date: Wed, 15 May 2024 11:55:16 +0800 Subject: [PATCH 1/2] Reformat --- lib/Myriad/Transport/Redis.pm | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/lib/Myriad/Transport/Redis.pm b/lib/Myriad/Transport/Redis.pm index 12bfe338..fe9a13bb 100644 --- a/lib/Myriad/Transport/Redis.pm +++ b/lib/Myriad/Transport/Redis.pm @@ -314,7 +314,11 @@ async method cleanup (%args) { my $oldest = await $self->oldest_processed_id($stream); $log->tracef('Attempting to clean up [%s] Size: %d | Earliest ID to care about: %s', $stream, $info->{length}, $oldest); if ($oldest and $oldest ne '0-0' and $self->compare_id($oldest, $info->{first_entry}[0]) > 0) { - my ($total) = await $redis->xtrim($stream, MINID => ($use_trim_exact ? () : '~'), $oldest); + my ($total) = await $redis->xtrim( + $stream, + MINID => ($use_trim_exact ? () : '~'), + $oldest + ); $log->tracef('Trimmed %d items from stream: %s', $total, $stream); } else { From a0685ce8cb1b7a1ab13069169580e70896fa2a21 Mon Sep 17 00:00:00 2001 From: Tom Molesworth Date: Wed, 15 May 2024 11:56:14 +0800 Subject: [PATCH 2/2] Fix Redis cleanup bug - XTRIM was not applying prefix --- lib/Myriad/Transport/Redis.pm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/Myriad/Transport/Redis.pm b/lib/Myriad/Transport/Redis.pm index fe9a13bb..2b8400f8 100644 --- a/lib/Myriad/Transport/Redis.pm +++ b/lib/Myriad/Transport/Redis.pm @@ -315,7 +315,7 @@ async method cleanup (%args) { $log->tracef('Attempting to clean up [%s] Size: %d | Earliest ID to care about: %s', $stream, $info->{length}, $oldest); if ($oldest and $oldest ne '0-0' and $self->compare_id($oldest, $info->{first_entry}[0]) > 0) { my ($total) = await $redis->xtrim( - $stream, + $self->apply_prefix($stream), MINID => ($use_trim_exact ? () : '~'), $oldest );