|
1 | 1 | use crate::pool::{Connection, ConnectionManager, ManagedConnection, Transaction}; |
2 | 2 | use crate::{ |
3 | | - ArtifactId, Benchmark, CollectionId, Commit, CommitType, CompileBenchmark, Date, Profile, |
| 3 | + ArtifactCollection, ArtifactId, Benchmark, CollectionId, Commit, CommitType, CompileBenchmark, |
| 4 | + Date, Profile, |
4 | 5 | }; |
5 | 6 | use crate::{ArtifactIdNumber, Index, QueryDatum, QueuedCommit}; |
6 | 7 | use chrono::{DateTime, NaiveDateTime, TimeZone, Utc}; |
@@ -1149,18 +1150,24 @@ impl Connection for SqliteConnection { |
1149 | 1150 | .collect() |
1150 | 1151 | } |
1151 | 1152 |
|
1152 | | - async fn last_end_time(&self) -> Option<DateTime<Utc>> { |
| 1153 | + async fn last_artifact_collection(&self) -> Option<ArtifactCollection> { |
1153 | 1154 | self.raw_ref() |
1154 | 1155 | .query_row( |
1155 | | - "select date_recorded + duration \ |
| 1156 | + "select date_recorded + duration, duration \ |
1156 | 1157 | from artifact_collection_duration \ |
1157 | 1158 | order by date_recorded desc \ |
1158 | 1159 | limit 1;", |
1159 | 1160 | params![], |
1160 | | - |r| Ok(Utc.timestamp_opt(r.get(0)?, 0).unwrap()), |
| 1161 | + |r| { |
| 1162 | + Ok(( |
| 1163 | + Utc.timestamp_opt(r.get(0)?, 0).unwrap(), |
| 1164 | + Duration::from_secs(r.get(1)?), |
| 1165 | + )) |
| 1166 | + }, |
1161 | 1167 | ) |
1162 | 1168 | .optional() |
1163 | 1169 | .unwrap() |
| 1170 | + .map(|(end_time, duration)| ArtifactCollection { end_time, duration }) |
1164 | 1171 | } |
1165 | 1172 |
|
1166 | 1173 | async fn parent_of(&self, sha: &str) -> Option<String> { |
|
0 commit comments