diff --git a/lib/OpenQA/Task/Git/Clone.pm b/lib/OpenQA/Task/Git/Clone.pm index 6e10b21d0501..c9c035642de4 100644 --- a/lib/OpenQA/Task/Git/Clone.pm +++ b/lib/OpenQA/Task/Git/Clone.pm @@ -6,6 +6,7 @@ use Mojo::Base 'Mojolicious::Plugin', -signatures; use Mojo::Util 'trim'; use Mojo::File; +use OpenQA::Log qw(log_debug); use Time::Seconds 'ONE_HOUR'; sub register ($self, $app, @) { @@ -30,9 +31,14 @@ sub _git_clone_all ($job, $clones) { # Prevent multiple git_clone tasks for the same path to run in parallel my @guards; for my $path (sort keys %$clones) { + my $guard_name = "git_clone_${path}_task"; $path = Mojo::File->new($path)->realpath if -e $path; # resolve symlinks - my $guard = $app->minion->guard("git_clone_${path}_task", 2 * ONE_HOUR); - return $job->retry($retry_delay) unless $guard; + my $guard = $app->minion->guard($guard_name, 2 * ONE_HOUR); + unless ($guard) { + log_debug("Could not get guard for '$guard_name', retrying in $retry_delay->{delay}s") + ; # uncoverable statement + return $job->retry($retry_delay); # uncoverable statement + } push @guards, $guard; }