From 603c286b50128a3ceb061f0e2c03310a00220977 Mon Sep 17 00:00:00 2001 From: Vinnie Okada Date: Sat, 20 Nov 2021 13:09:10 -0700 Subject: [PATCH] Don't iterate over snaps twice Process snapshots in one pass rather than looping separately for both guid and create time. --- syncoid | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/syncoid b/syncoid index 1ceed0c..d0afe10 100755 --- a/syncoid +++ b/syncoid @@ -1541,11 +1541,8 @@ sub getsnaps() { $snap =~ s/^.*\@(.*)\tguid.*$/$1/; $snaps{$type}{$snap}{'guid'}=$guid; } - } - - foreach my $line (@rawsnaps) { # only import snap creations from the specified filesystem - if ($line =~ /\Q$fs\E\@.*creation/) { + elsif ($line =~ /\Q$fs\E\@.*creation/) { chomp $line; my $creation = $line; $creation =~ s/^.*\tcreation\t*(\d*).*/$1/;