diff options
author | Lin Jen-Shin <godfat@godfat.org> | 2016-08-29 20:24:48 +0800 |
---|---|---|
committer | Lin Jen-Shin <godfat@godfat.org> | 2016-08-29 20:24:48 +0800 |
commit | ace0a005b8bda05db224c21ac5ea691c3ffb6fb6 (patch) | |
tree | 9df3a073e7485ef9cd4a0347af932e4a241dc2cb /app | |
parent | 64366209ffe23aff467f707e85a10f8a5b4a39cd (diff) | |
download | gitlab-ce-ace0a005b8bda05db224c21ac5ea691c3ffb6fb6.tar.gz |
Smartly calculate real running time and pending time
Diffstat (limited to 'app')
-rw-r--r-- | app/models/ci/pipeline.rb | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/app/models/ci/pipeline.rb b/app/models/ci/pipeline.rb index 03812cd195f..e59c90e7e0c 100644 --- a/app/models/ci/pipeline.rb +++ b/app/models/ci/pipeline.rb @@ -258,7 +258,13 @@ module Ci end def update_duration - self.duration = calculate_duration + calculated_status = %w[success failed running canceled] + calculated_builds = builds.latest.where(status: calculated_status) + calculator = PipelineDuration.from_builds(calculated_builds) + + self.duration = calculator.duration + self.pending_duration = + started_at - created_at + calculator.pending_duration end def execute_hooks |