summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorLin Jen-Shin <godfat@godfat.org>2016-09-02 21:08:26 +0800
committerLin Jen-Shin <godfat@godfat.org>2016-09-02 21:08:26 +0800
commitdefd8899056c26593939243b05c365605ac06fdc (patch)
treef08b4e6722e73632de2a093419372e4d7e9dd017 /lib
parent1ccb578ec89df5d69c997920fd512a1db44e309d (diff)
downloadgitlab-ce-defd8899056c26593939243b05c365605ac06fdc.tar.gz
Actually we still need to use total - running to get:
real pending time, because that's actually by definition, (the time that it's not running!) or we could end up with awfully complicated algorithm :(
Diffstat (limited to 'lib')
-rw-r--r--lib/gitlab/ci/pipeline_duration.rb7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/gitlab/ci/pipeline_duration.rb b/lib/gitlab/ci/pipeline_duration.rb
index baf84954b7e..0c7c38e2b67 100644
--- a/lib/gitlab/ci/pipeline_duration.rb
+++ b/lib/gitlab/ci/pipeline_duration.rb
@@ -110,10 +110,11 @@ module Gitlab
status = %w[success failed running canceled]
builds = pipeline.builds.latest.where(status: status)
- duration = from_builds(builds, :started_at, :finished_at).duration
- queued = from_builds(builds, :queued_at, :started_at).duration
+ running = from_builds(builds, :started_at, :finished_at).duration
+ total = from_builds(builds, :queued_at, :finished_at).duration
+ pending = pipeline.started_at - pipeline.created_at
- [duration, pipeline.started_at - pipeline.created_at + queued]
+ [running, pending + total - running]
end
def self.from_builds(builds, from, to)