mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2025-10-22 03:07:35 +00:00
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:
@@ -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;
|
||||
}
|
||||
|
||||
|
@@ -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;
|
||||
|
||||
|
Reference in New Issue
Block a user