Skip to content

Commit b295d47

Browse files
committed
Simplify Resource::Locks with direct return of booleans
1 parent 454385e commit b295d47

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

lib/OpenQA/Resource/Locks.pm

+2-6
Original file line numberDiff line numberDiff line change
@@ -121,16 +121,12 @@ sub barrier_wait ($name = undef, $jobid = undef, $where = undef, $check_dead_job
121121
}
122122
}
123123

124-
if (grep { $_ eq $jobid } @jobs) {
125-
return 1 if @jobs == $barrier->count;
126-
return 0;
127-
}
124+
return @jobs == $barrier->count if grep { $_ eq $jobid } @jobs;
128125

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

132-
return 1 if @jobs == $barrier->count;
133-
return 0;
129+
return @jobs == $barrier->count;
134130
}
135131

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

0 commit comments

Comments
 (0)