Fix pipeline timestamps (#730)

* only calculate time on running builds

* Add updated timestamp into database and use it in frontend

* add more trace logging

* refactor (move grpc unrelated func into related package)

* fix xorm schema

* add todo
This commit is contained in:
6543
2022-01-31 15:38:39 +01:00
committed by GitHub
parent 6af94d79e3
commit 2a5159f7fe
5 changed files with 58 additions and 39 deletions

View File

@@ -40,13 +40,17 @@ export default (build: Ref<Build | undefined>) => {
}
const start = build.value.started_at || 0;
const end = build.value.finished_at || 0;
const end = build.value.finished_at || build.value.updated_at || 0;
if (start === 0) {
return 0;
}
if (end === 0) {
// only calculate time on running builds
if (build.value.status !== 'running') {
return 0;
}
return Date.now() - start * 1000;
}

View File

@@ -18,6 +18,9 @@ export type Build = {
// When the build request was received.
created_at: number;
// When the build was updated last time in database.
updated_at: number;
// When the build was enqueued.
enqueued_at: number;