Skip to content

Commit

Permalink
Simplify Resource::Locks with direct return of boolean calculations
Browse files Browse the repository at this point in the history
  • Loading branch information
okurz committed Mar 14, 2024
1 parent 454385e commit e343040
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions lib/OpenQA/Resource/Locks.pm
Original file line number Diff line number Diff line change
Expand Up @@ -121,16 +121,12 @@ sub barrier_wait ($name = undef, $jobid = undef, $where = undef, $check_dead_job
}
}

if (grep { $_ eq $jobid } @jobs) {
return 1 if @jobs == $barrier->count;
return 0;
}
return @jobs == $barrier->count if grep { $_ eq $jobid } @jobs;

push @jobs, $jobid;
$barrier->update({locked_by => join(',', @jobs)});

return 1 if @jobs == $barrier->count;
return 0;
return @jobs == $barrier->count;
}

sub barrier_destroy ($name = undef, $jobid = undef, $where = undef) {
Expand Down

0 comments on commit e343040

Please sign in to comment.