Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(ui): shutting down status inconsistency #371

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions libs/sdm/src/image/task/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,10 @@ impl<C: ManagedProtocol> RunnableContext<ImageTask<C>> for TaskContext<ImageTask
async fn update(&mut self) -> Result<(), Error> {
self.process_update_impl().await
}

fn is_active(&mut self) -> bool {
matches!(self.status.get(), Status::Active { .. })
}
}

impl<C: ManagedProtocol> TaskContext<ImageTask<C>> {
Expand Down
4 changes: 4 additions & 0 deletions libs/sdm/src/network/task/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ impl<C: ManagedProtocol> RunnableContext<NetworkTask<C>> for TaskContext<Network
async fn update(&mut self) -> Result<(), Error> {
self.process_update_impl().await
}

fn is_active(&mut self) -> bool {
matches!(self.status.get(), Status::Active { .. })
}
}

#[derive(Debug)]
Expand Down
9 changes: 7 additions & 2 deletions libs/sdm/src/task.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@ pub trait RunnableContext<T: RunnableTask> {
fn process_inner_event(&mut self, event: <T::Protocol as ManagedProtocol>::Inner);
fn process_event(&mut self, event: T::Event) -> Result<(), Error>;
async fn update(&mut self) -> Result<(), Error>;
fn is_active(&mut self) -> bool;
}

pub struct TaskSender<E, P: ManagedProtocol> {
Expand Down Expand Up @@ -387,8 +388,12 @@ where
if is_active && self.context.should_start != is_active {
drop(self.context.update_task_status(TaskStatusValue::Waiting));
debug!("[SdmTaskRunner::reconfigure] Task {} is queued to start", self.task_id)
} else if !is_active && self.context.should_start != is_active {
drop(self.context.update_task_status(TaskStatusValue::ShuttingDown));
} else if !is_active && self.context.should_start {
if self.context.is_active() {
drop(self.context.update_task_status(TaskStatusValue::ShuttingDown));
} else {
drop(self.context.update_task_status(TaskStatusValue::Inactive));
}
} else {
debug!(
"[SdmTaskRunner::reconfigure] Task {} is NOT queued to start",
Expand Down
4 changes: 4 additions & 0 deletions libs/sdm/src/volume/task/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ impl<C: ManagedProtocol> RunnableContext<VolumeTask<C>> for TaskContext<VolumeTa
async fn update(&mut self) -> Result<(), Error> {
self.process_update_impl().await
}

fn is_active(&mut self) -> bool {
matches!(self.status.get(), Status::Active { .. })
}
}

#[derive(Debug)]
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"scripts": {
"start": "cd ui/frontend && npm run build && cargo run --bin tari_bus_tauri",
"start": "cd ui/frontend && npm run build && cargo run --bin tari_launchpad",
"dev": "cd ui/frontend && npm run dev",
"tauri": "tauri"
},
Expand Down