diff options
Diffstat (limited to 'lib/gitlab/ci/pipeline_duration.rb')
-rw-r--r-- | lib/gitlab/ci/pipeline_duration.rb | 20 |
1 files changed, 9 insertions, 11 deletions
diff --git a/lib/gitlab/ci/pipeline_duration.rb b/lib/gitlab/ci/pipeline_duration.rb index f97727e8548..e37ba19bca9 100644 --- a/lib/gitlab/ci/pipeline_duration.rb +++ b/lib/gitlab/ci/pipeline_duration.rb @@ -132,18 +132,16 @@ module Gitlab end def process_periods(periods) - if periods.empty? - periods - else - periods.drop(1).inject([periods.first]) do |result, current| - merged = try_merge_period(result.last, current) + return periods if periods.empty? - if merged - result[-1] = merged - result - else - result << current - end + periods.drop(1).inject([periods.first]) do |result, current| + merged = try_merge_period(result.last, current) + + if merged + result[-1] = merged + result + else + result << current end end end |