Skip to content

Commit

Permalink
name ~> action_name
Browse files Browse the repository at this point in the history
  • Loading branch information
Devdutt Shenoi committed May 27, 2024
1 parent 5d7e4da commit 15edaa4
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 7 deletions.
3 changes: 2 additions & 1 deletion uplink/src/base/actions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,5 +114,6 @@ impl Point for ActionResponse {
#[derive(Debug, Deserialize, Serialize)]
pub struct Cancellation {
pub action_id: String,
pub name: String,
#[serde(rename = "name")]
pub action_name: String,
}
12 changes: 6 additions & 6 deletions uplink/src/base/bridge/actions_lane.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,15 +191,15 @@ impl ActionsBridge {
continue;
}

let cancellation = Cancellation { action_id: action_id.clone(), name: action_name };
let cancellation = Cancellation { action_id, action_name };
let payload = serde_json::to_string(&cancellation)?;
let cancel_action = Action {
action_id: "timeout".to_owned(), // Describes cause of action cancellation. NOTE: Action handler shouldn't expect an integer.
name: "cancel_action".to_owned(),
payload,
};
if route.try_send(cancel_action).is_err() {
error!("Couldn't cancel action ({}) on timeout: {}", action_id, Error::UnresponsiveReceiver);
error!("Couldn't cancel action ({}) on timeout: {}", cancellation.action_id, Error::UnresponsiveReceiver);
// Remove action anyways
self.clear_current_action();
continue;
Expand Down Expand Up @@ -298,17 +298,17 @@ impl ActionsBridge {
}

info!("Received action cancellation: {:?}", cancellation);
if cancellation.name != current_action.action.name {
if cancellation.action_name != current_action.action.name {
debug!(
"Action was redirected: {} ~> {}",
cancellation.name, current_action.action.name
cancellation.action_name, current_action.action.name
);
current_action.action.name.clone_into(&mut cancellation.name);
current_action.action.name.clone_into(&mut cancellation.action_name);
}

let route = self
.action_routes
.get(&cancellation.name)
.get(&cancellation.action_name)
.expect("Action shouldn't be in execution if it can't be routed!");

// Ensure that action redirections for the action are turned off,
Expand Down

0 comments on commit 15edaa4

Please sign in to comment.