Add support for parsing the flake.lock.
This commit is contained in:
@@ -26,14 +26,16 @@ pub(crate) struct RunningBuild<'db> {
|
||||
db_handle: &'db DbHandle,
|
||||
activity_tree: ActivityTreeStream,
|
||||
last_announce: Option<Instant>,
|
||||
build_id: i64,
|
||||
}
|
||||
|
||||
impl<'db> RunningBuild<'db> {
|
||||
pub(crate) fn new(db_handle: &'db DbHandle) -> Result<Self> {
|
||||
pub(crate) fn new(db_handle: &'db DbHandle, build_id: i64) -> Result<Self> {
|
||||
Ok(RunningBuild {
|
||||
db_handle,
|
||||
activity_tree: ActivityTreeStream::new(),
|
||||
last_announce: None,
|
||||
build_id,
|
||||
})
|
||||
}
|
||||
|
||||
@@ -45,16 +47,6 @@ impl<'db> RunningBuild<'db> {
|
||||
where
|
||||
TN: AsRef<str>,
|
||||
{
|
||||
let foo = SystemTime::now().duration_since(SystemTime::UNIX_EPOCH)?;
|
||||
let now = Instant::now();
|
||||
let build_id: i64 = sqlx::query(
|
||||
r#"INSERT INTO build (start_time, target) SELECT unixepoch('now'), ? RETURNING id"#,
|
||||
)
|
||||
.bind(target_name.as_ref())
|
||||
.fetch_one(&self.db_handle.conn)
|
||||
.await?
|
||||
.try_get("id")?;
|
||||
|
||||
let output_stream = OutputStream::from_child(&mut child)?;
|
||||
let mut nix_output_stream: NixOutputStream<OutputStream> =
|
||||
NixOutputStream::new(output_stream);
|
||||
@@ -81,7 +73,7 @@ impl<'db> RunningBuild<'db> {
|
||||
.code()
|
||||
.expect("Process should have an exit code."),
|
||||
)
|
||||
.bind(build_id)
|
||||
.bind(self.build_id)
|
||||
.execute(&self.db_handle.conn)
|
||||
.await?
|
||||
.rows_affected();
|
||||
|
||||
Reference in New Issue
Block a user