set status correctly
This commit is contained in:
parent
15b2fe7e29
commit
d409d08572
@ -24,11 +24,6 @@ RUN pacman -Syyu --noconfirm
|
|||||||
RUN pacman -S --noconfirm base-devel git
|
RUN pacman -S --noconfirm base-devel git
|
||||||
RUN pacman -Sc
|
RUN pacman -Sc
|
||||||
|
|
||||||
# Set any additional configurations or dependencies if required
|
|
||||||
|
|
||||||
# Example: Expose a port if your application listens on a specific port
|
|
||||||
# EXPOSE 8080
|
|
||||||
|
|
||||||
# Set the entry point or default command to run your application
|
# Set the entry point or default command to run your application
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
CMD ["untitled"]
|
CMD ["untitled"]
|
||||||
|
@ -24,7 +24,7 @@ pub async fn init(db: DatabaseConnection, tx: Sender<Action>) {
|
|||||||
status: Set(Some(0)),
|
status: Set(Some(0)),
|
||||||
..Default::default()
|
..Default::default()
|
||||||
};
|
};
|
||||||
let new_build = build.save(&db).await.unwrap();
|
let mut new_build = build.save(&db).await.unwrap();
|
||||||
|
|
||||||
// spawn new thread for each pkg build
|
// spawn new thread for each pkg build
|
||||||
// todo add queue and build two packages in parallel
|
// todo add queue and build two packages in parallel
|
||||||
@ -32,6 +32,7 @@ pub async fn init(db: DatabaseConnection, tx: Sender<Action>) {
|
|||||||
let (tx, mut rx) = broadcast::channel::<String>(3);
|
let (tx, mut rx) = broadcast::channel::<String>(3);
|
||||||
|
|
||||||
let db2 = db.clone();
|
let db2 = db.clone();
|
||||||
|
let new_build2 = new_build.clone();
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
loop {
|
loop {
|
||||||
match rx.recv().await {
|
match rx.recv().await {
|
||||||
@ -41,7 +42,7 @@ pub async fn init(db: DatabaseConnection, tx: Sender<Action>) {
|
|||||||
let _ = append_db_log_output(
|
let _ = append_db_log_output(
|
||||||
&db2,
|
&db2,
|
||||||
output_line,
|
output_line,
|
||||||
new_build.id.clone().unwrap(),
|
new_build2.id.clone().unwrap(),
|
||||||
)
|
)
|
||||||
.await;
|
.await;
|
||||||
}
|
}
|
||||||
@ -67,6 +68,10 @@ pub async fn init(db: DatabaseConnection, tx: Sender<Action>) {
|
|||||||
|
|
||||||
version_model.file_name = Set(Some(pkg_file_name));
|
version_model.file_name = Set(Some(pkg_file_name));
|
||||||
let _ = version_model.update(&db).await;
|
let _ = version_model.update(&db).await;
|
||||||
|
|
||||||
|
new_build.status = Set(Some(1));
|
||||||
|
let _ = new_build.update(&db).await;
|
||||||
|
|
||||||
}
|
}
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
let _ = set_pkg_status(
|
let _ = set_pkg_status(
|
||||||
@ -77,6 +82,9 @@ pub async fn init(db: DatabaseConnection, tx: Sender<Action>) {
|
|||||||
.await;
|
.await;
|
||||||
let _ = version_model.update(&db).await;
|
let _ = version_model.update(&db).await;
|
||||||
|
|
||||||
|
new_build.status = Set(Some(1));
|
||||||
|
let _ = new_build.update(&db).await;
|
||||||
|
|
||||||
println!("Error: {e}")
|
println!("Error: {e}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -93,15 +101,13 @@ async fn set_pkg_status(
|
|||||||
package_id: i32,
|
package_id: i32,
|
||||||
status: i32,
|
status: i32,
|
||||||
) -> anyhow::Result<()> {
|
) -> anyhow::Result<()> {
|
||||||
let mut pkg = Packages::find_by_id(package_id)
|
let mut pkg: packages::ActiveModel = Packages::find_by_id(package_id)
|
||||||
.one(db)
|
.one(db)
|
||||||
.await?
|
.await?
|
||||||
.ok_or(anyhow!("no package with id {package_id} found"))?;
|
.ok_or(anyhow!("no package with id {package_id} found"))?
|
||||||
|
.into();
|
||||||
pkg.status = status;
|
|
||||||
|
|
||||||
let pkg: packages::ActiveModel = pkg.into();
|
|
||||||
|
|
||||||
|
pkg.status = Set(status);
|
||||||
pkg.update(db).await?;
|
pkg.update(db).await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user