Skip to content

Conversation

@bncer
Copy link
Contributor

@bncer bncer commented Dec 13, 2025

Related to #486

Note:

  • running_time from BorsRepositoryEvent::WorkflowCompleted::WorkflowRunCompleted, which calculates duration
  • Currently in this PR try builds written to the duration column of the build table for possible future use. Try build duration records should not effect performance, we will filter out only successfully completed auto builds.

Copy link
Member

@Kobzol Kobzol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, thank you for the PR! Could you also add code that loads the duration from the DB into the build model? Just so that we can check that the Interval type can be correctly deserialized into Rust.

@@ -0,0 +1,2 @@
-- Add up migration script here
ALTER TABLE build ADD COLUMN duration INTERVAL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Huh, first time I see this (Postgre)SQL data type. Cute.

};

db.update_build_status(&build, status).await?;
db.update_build_duration(&build, payload.running_time)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's modify the duration in the db.update_build_status call, to avoid doing two back-to-back SQL queries unnecessarily. I plan to extend the update_build_status function in the near future anyway.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was about to add duration in db.update_build_status, but saw this function was used elsewhere which changes only status.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's fine, it can just be Option<Duration>.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants